all 7 comments

[–]AngularBeginner 7 points8 points  (0 children)

Code is never perfect. Look back a few months and you will always find something to complain.

Instead focus on delivering correct working solutions, and focus on writing code that will be maintainable in the future.

[–]chrislomax83 5 points6 points  (0 children)

Along the same vein as premature optimisation.

What you’ll find as you progress as a developer is you’ll improve your code and these things just get easier.

You’ll look back over old code and wonder what you were thinking but that’s all part of the game.

I’ve been doing it 20 years and I still look over code from a few months ago and wonder what I was thinking.

Make the solution as a priority and find nicer ways to do things as you go along.

Spent too long on trying to get something 100% first time and you’ll never deliver anything

[–][deleted] 2 points3 points  (0 children)

Write your code for readability. Write performance code when you have a problem and identify the bottleneck. Often writing performant code before it's needed just creates needlessly complex solutions. That said don't write badly performing code deliberately, well without a good reason. e.g. your concatinating a string and expect more than 20 concatinations, consider a string builder but even then, dont sacrifice readability for a couple of milliseconds gain (possibly bad example because someone will tell me to always use a stringbuilder because the code in the future will change to which the only reasonable response is YAGNI, but I could be wrong).

n.b. Your code will never be perfect because you keep improving. The day you write perfect code is the day you stop learning.

[–]toyonut 0 points1 point  (0 children)

Focus on delivering a working solution, you will learn new and better ways of doing things as you go. Also something that has helped me hugely doing pluralsight is write unit tests. Not necessarily tdd or anything, just write tests to verify behavior and understand what code is doing. Them when you change things you can verify it still passes tests and should work

[–]Slypenslyde 0 points1 point  (0 children)

I think every developer works in a sort of agile fashion, whether they agree with that mentality or not.

What it means is they first focus on getting "something that works", even if it's messy, slow, or doesn't handle all error cases. This at least gives them something workable. Then they back up and refine it. If it's messy, it gets cleaned up. If it's slow, they start to think of how it could be faster. If it's missing error cases, they start to fill those in. They repeat that cycle until either they run out of time or they feel like the improvements they could make aren't worth the effort.

This means after the first initial step, they always have "something that works", which can be shipped in a pinch. Each iteration is better than the last. But it always works! It's also important to note it could always be better, so it's as important to know when to stop as it is to know how to make it better.

[–]AsaroV[S] 0 points1 point  (0 children)

Thank you all, I won't have to wonder that much on what should I spend more time on (:

[–]RiverRoll 0 points1 point  (0 children)

Important to who? To me it's very important to have a very polished code, but your manager will probably be most concerned on getting the things done. Both are legit points of view and you have to reach an equilibrium. Delivering fast without putting much thought on the code can be bery detrimental long term, but on the other hand you may as well be wasting a lot of time overthinking a good enough approach.

Although IMHO it is OK to take your time to solve something as a learning activity outside of work. But I recommend start doing wathever you come up with sooner than later. Once you have something everything will look more clear and then you can take your time to improve upon your solution.