Code a dirty solution first and then work on optimization

in #palnet4 years ago


Source

Developers are always focused on writing optimized code. When we start with new projects and start coding, every step we take, we always have this in mind that we should be writing optimized code. This is something that is commonly seen among all the developers. I also had the same syndrome and still have that even today. That's why when I start coding something I spend enough time to prepare the architecture and the approach I'm going to be taking before even I spend some time coding it.

I wouldn't say that it is wrong but recently I had a conversation with one of the experienced architects in my work environment. I was discussing various topics with him. He is not someone with dead weight or something and he is very open to explaining tips and tricks that he regularly follows in his coding practices. It was indeed a great opportunity for me to talk in detail about certain aspects of coding with him. There are many things that I discussed with him and most of the items that I discussed definitely enlightened me.

Source

Finding the solution first

He explained to me the approaches he would be taking when he starts working on a new project. The first and foremost thing that he would do is to find a solution first for the requirement. He will not care about the optimization of code or anything. The first thing that he would do is to find a way to bring the requirement live. He told me that if the userbase is very minimal, we can even make the application live as an alpha version and gradually sit and improvise the code.

The first solution draft that we do can be a dirty code. It need not necessarily be an optimized one. This is something that I sometimes find it hard to agree. I told him my difficulty in understanding this. Usually when we sit and achieve the requirement, we already spend several hours coding and if we have to not think about optimized solution before bringing the solution, it can be something like we end up doing the work twice where it would take some extra hours to first write a dirty code and then work on optimizing the code that we have written.

Source

In my case, if I try to bring a solution with some dirty coding and make it work, I usually become lazy to work on optimizing the code that I wrote. The thought that I would get is to just let it be like that and focus on my future projects after that. This is the practical difficulty that I usually face when I start coding a new project. He told from his experience that it is always okay to spend time optimizing after having a solution in hand than spending time before the project before even having anything working in hand.

In a way, I was able to understand what he was trying to say. I have personally experienced some stress when I don't get an optimized way to implement something. I keep trying several times until I get frustrated. But during some instances when I try to first do the dirty code and activate the solution and then work on optimization part, it is usually becoming quite relaxing comparatively because my mind will know that there is already a solution available so we are safe and all that I'm trying to do is optimization part. So, psychologically I don't even take so much stress in such situations.



Posted from my blog with SteemPress : https://bala-blog.com/code-a-dirty-solution-first-and-then-work-on-optimization/

SteemPress
Sort:  

!trdovoter 100

Congratulations @trendo.marketing, you are successfuly trended the post that shared by @bala41288!
@bala41288 will receive 32.56737638 TRDO & @trendo.marketing will get 21.71158425 TRDO curation in 3 Days from Post Created Date!

"Call TRDO, Your Comment Worth Something!"

To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Your post has been curated by the bitcoin myk project. Tokens are available for this account you can trade for steem at: https://steem-engine.com/. Join our curation priority list to earn more tokens by registering at:

http://www.bitcoinmyk.com/register/

Bitcoin MYK
admin
Register - Bitcoin MYK

Congratulations @trendo.marketing, 100% upvote has been shared with your successful call on the post that shared by @bala41288!


Support @trendotoken projects by delegating : 100SP , 200SP , 500SP , 1000SP , 2000SP

Congratulations @bala41288, your post successfully recieved 32.56737638 TRDO from below listed TRENDO callers:

@trendo.marketing earned : 21.71158425 TRDO curation


To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.032
BTC 63585.64
ETH 3035.86
USDT 1.00
SBD 3.84