DEV Community

Good habits, good code quality

Davide de Paolis on September 07, 2020

“Don’t expect to be motivated every day to get out there and make things happen. You won’t be. Don’t count on motivation. Count on Discipline.” Jo...
Collapse
 
louislow profile image
Louis Low

Many startup companies that I joined in my country hate me because I am too discipline to prevent them to write shitty and sloppy codes. Every time I look at their codes, either existing or new project, I always say Motherfuck in my head. One thing particular is they love making product presentations like fairytales in front of the stakeholders or to their audience. But the product, in reality, sucks in every single way.

Collapse
 
kretaceous profile image
Abhijit Hota

I feel this. I'm not the neatest code writer but I always try to write it properly, albeit of the process being slow.

And by proper I don't mean the most efficient way to do it. As the quote from Coding Horror, we've to refactor it in the end.

But the thing you're implementing now should at least be compatible and sane enough to be used by the rest of the team.

Don't necessarily look for optimal solutions but always try to look for clean ones. You'll find the best ones along the way.

Collapse
 
psiho profile image
Mirko Vukušić • Edited

I've heard too many discussions in my life, between my employees, who and what is more important, developer, designer, sales, management. Usually they had similar tone to your post (rant?). However, in reality, company or a startup project) is so much more than any individual part of it. Sorry, but i dont get tolerance, nor any effort to see a wider picture from your post. Clean code in most cases is desirable, but not in 100% of cases. It's impossible to judge based on the data in your post. But thats not even the most important part. Your comment on their sales and presentation of the product just sounds really bad. What other than that you expect? That they market it as a junk? Id say their sails does great job!

From perspective of a person in this business for 30 years, worked everything from junior developer, over project manager to CEO and owner, my guess is that companies you mention don't have issues with your clean code ideas, but with a way how you present them and (maybe) try to enforce them in the company.

Collapse
 
louislow profile image
Louis Low

Well, thanks for the compliment. I love my rant. Which makes me a better veteran electronic and software engineer. Please... Do not hire me if any chances.

Collapse
 
dvddpl profile image
Davide de Paolis

Yep. i guess that could be a problem in many startup that are alwasy rushing and moving from Prototypes to MVP to Fullfledge App in a matter of weeks ( and with the same code base.. )

Collapse
 
napravicukod profile image
Rudolf Jurišić

Great topic and some good points. I suppose lots of people can relate with this topic.

However, experience thought me that you should not count on self-discipline. You need to have a system. And be consistent with that system. A set of rules that produces consequences when you brake them. That makes creating habits more likely to happen.

Collapse
 
scottstern06 profile image
Scott

Loved this post! Youre so right, the times we actually get to go back and have the time to refactor are hard to prioritize!

I love how you explained how the code you right can become a habit, so focus on the habits and good code will come.

I wrote something along similar lines about motivation, and I too quoted Jocko. lol scottistern.com/motivation/

Collapse
 
dvddpl profile image
Davide de Paolis • Edited

Thanks. I checked your post out. Very nice.

Why dont I want to do this?

That's exactly the point. I ask myself that question all the time, and the answer is, because I am scared, because it is difficult, because I don't know how to do it.. And those are exactly the reassons why I must do it 😅

Collapse
 
deozza profile image
Edenn Touitou

Heck. All the excuses you gave about quickly writing functionnal code and not bothering with code quality and sturdyness, I already heard them from my boss every 2 or 3 days.

I learnt the hard way at a precedent job with TDD, code coverage, law of Demeter, ... and here, it's all about delivering features, 500 lines of code for a function, copy paste everywhere. And everytime I want to apply and justify the need for good practices, the answer is "do a functionnal code that works, we will see later for adding sparkles to it. Don't do quality code for the sake of doing it, the feature is the priority".

Collapse
 
dvddpl profile image
Davide de Paolis

Don't do quality code for the sake of doing it, the feature is the priority
It kinda make sense, to some extent. I saw many devs literally waste weeks for refactoring useless parts of code just because they learnt a new code design pattern.. (and probably I made that mistake too in the past) but overall quality pays off over time, in productivity, and mood.

Collapse
 
maulik profile image
Maulik

Awesome article. Loved the first quote.

Collapse
 
dvddpl profile image
Davide de Paolis • Edited

interesting. i didnt know the quote was from Milton Friedman. I've always known the generic version of "the temporary solution" :-)
and the Design Stamina Hypotesis link is priceless. thanx