What is good code?

Ramazan Ramazanov
2 min readMar 1, 2021

--

There are two main things we talk about when we say this is good code. What would you tell somebody if you ask them to write good code?

Good code can be described in two things or two points.

One is readability. It is important that your code is just generally clean and others can understand it.

Second is scalability. Big-O notation is what allows us to measure this idea of scalable code that can scale something. For this blog post, we will be focusing on the idea of a scalable code.

Let’s imagine that we have a task where we want to bake a cake. We have a recipe over here and this recipe we are going to use in our kitchen to bake a cake. And there is a good way of baking a cake and a bad way. We give it the instructions and that is their recipe.

Computers are machines and these machines need to work in order to produce something for us. Computers work in the same way, so we have these instructions that we give it through code and they provide some sort of an output. For example, we give the computer an instruction to say “hey, turn on the light in the room”. A coder is someone that gives these instructions. Just like there are ways to bake a cake in the kitchen with many recipes and ingredients, there are many ways to solve a problem through code.

In the code example above the output is “Found NEMO!” demonstrated on the right side. This is the instruction that we gave the computer. We told it that we have an array and we have a function, an action that we want to perform called find Nemo that takes an array which is Nimo. It is going to receive this array and then it is going to loop over the array.

When we talk about Big-O and scalability of code, we simply mean that when we grow bigger and bigger with out output how much does the algorithm or function slow down. If the list of characters or elements increases, how many more operations we have to do. This is what we call algorithmic efficiency and Big-O allows us to explain this concept.

--

--

No responses yet