Failing to write the code for the next Google? Well, friend, you are in luck today!!! Today I will share the only two things you need to keep in mind while programming.
1️⃣ Think that you are writing code for the best software company in the galaxy and it needs to be super-efficient.
2️⃣ Think that you are writing code for a person who just has started to code and it needs to be super readable.
That's it!!! Isn't that simple?
Avoid "Get the job done" type of codes. Yeah, they can get the job done for 'you' and for a small amount of data, when you are talking about a huge chunk of data it may take several hours to process. So, try to code optimized code and make sure it can run efficiently for any given test cases. (You can write "Get the job done" kind of code and then optimize it)
The topic is pretty self-explanatory so I don't need to type more just let me clarify it with the following example:
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
print('h', end="")
print('e', end="")
print('l', end="")
print('l', end="")
print('o', end="")
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
print('hello')
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
Well, it's a small code and both outputs hello. But for the first code, you can't say what it will do at a glance. You can easily understand that the second code will print hello.
So, at the end of the day, it is clear that writing efficient and easy to read code is more important than writing "Get the job done" kind to codes. Whether you are in a company or just writing personal projects, follow the rules and you will clearly see the benefits. If you can't hit the bullseye at a single trial than try to code to get the job done and then optimize it on the way.
Happy coding for you
Top comments (0)