Live data from Hacker News

Do you worry about the quality of code?

news.ycombinator.com

11–18 of 18 posts

Re: Do you worry about the quality of code?

#11
post #7

I absolutely think about clean and quality code. The easiest way to do it, in my opinion, is to write the most customizable and modular code from the beginning. Because, inevitably, mid-project you'll want to use something you've already written with a slight twist or use a class somewhere else where you didn't know you'd need it - but now you can just drop that sucker in and spend no time making a totally new class…

Awesome. This is something I try to follow. I use the same concepts that you have listed here. Conforming to the MVC pattern makes it easier to develop. Since my team is using Parse, we don't have to worry about Data Objects and Web Services, but we do have Controllers, Data Managers and Utility functions in our app.

I checked out your github account for the HN app and it is a beautifully written one. Great work.

Re: Do you worry about the quality of code?

#12
If I'm working on a homework assignment, yes I go over it a few times and clean it up.

If I'm working on our startup, I often google / copy+paste, whatever gets the job done. If I find myself struggling to make it work how I want or I'm spending more time fighting with the code than I'd prefer, I go back and refactor the code.

Re: Do you worry about the quality of code?

#13
Code quality means a lot in my opinion. A nicely structured and organized code not only shows its programmers' expert skills but makes it easier (and faster!) to modify or extend the present functionalities. Also if you care about code quality it really helps you to develop your skills.

As others stated it is needed to start a project in a way that you care about the quality. Even when there have not been a single line written. Also being agile also means that you refactor and redesign from time to time when it is needed.

I always check my code after implementing a functionality. If it is needed, I refactor my code. Also there are numerous tools to check code quality (e.g. Sonar). A very good approach is to have code reviews as well if you can.

There is a very nice book in this topic which the others have not mentioned, but if you are interested I advise to read it: Clean Code by Robert C. Martin.

Re: Do you worry about the quality of code?

#14
I'd assert that if you're a great developer, then the code you write quickly is not worse than the code you write slowly. For every problem there is a perfect way to solve it, and every hack and other kind of ugliness your code acquires increases the distance of your code from the ideal one.

If you write code too fast it gets those imperfections because you are not yet good enough. But you are on your way to improve since you are able to reflect on your work and see how it can be better.

A good way to get better is to write code as slowly as possible. Take your time and focus on making every detail as good as you can. It will take time but as long as you do it slowly enough you will learn a lot. You will get better as your "slow and perfect" time improves and your brain adapts. You will improve much faster than in "fast and sloppy" mode which trains your brain to not mind the ugliness.

Re: Do you worry about the quality of code?

#15
post #14

I'd assert that if you're a great developer, then the code you write quickly is not worse than the code you write slowly. For every problem there is a perfect way to solve it, and every hack and other kind of ugliness your code acquires increases the distance of your code from the ideal one. If you write code too fast it gets those imperfections because you are not yet good enough. But you are on your way to improve…

I'd have to disagree there. No matter how good a developer you are, if you're in a rush, you're not going to output the same quality. There's always going to thousands of decisions in a programmers head where they could take time to make something more efficient. If time is the top priority, then well designed code isn't.

And for what it's worth, I don't think that code needs to be perfect. If you're testing out an idea, your code may just need to be good enough to test the idea. Then when the idea has been validated, you can worry about perfecting the code.

Re: Do you worry about the quality of code?

#16
post #14

I'd assert that if you're a great developer, then the code you write quickly is not worse than the code you write slowly. For every problem there is a perfect way to solve it, and every hack and other kind of ugliness your code acquires increases the distance of your code from the ideal one. If you write code too fast it gets those imperfections because you are not yet good enough. But you are on your way to improve…

I'd have to disagree there. No matter how good a developer you are, if you're in a rush, you're not going to output the same quality. There's always going to thousands of decisions in a programmers head where they could take time to make something more efficient. If time is the top priority, then well designed code isn't. And for what it's worth, I don't think that code needs to be perfect. If you're testing out an i…

Well I disagree with you. :) Being in a rush almost by definition means that you have to perform faster than you're capable of. But the point is that you can push your limit on what "being in a rush" means by practicing. A few hours might be impossibly rushed for one programmer while it is ample time for another. Furthermore the more you train yourself on writing good code, the less of a speed advantage it is to write bad code.

Re: Do you worry about the quality of code?

#17
post #11
post #7

I absolutely think about clean and quality code. The easiest way to do it, in my opinion, is to write the most customizable and modular code from the beginning. Because, inevitably, mid-project you'll want to use something you've already written with a slight twist or use a class somewhere else where you didn't know you'd need it - but now you can just drop that sucker in and spend no time making a totally new class…

Awesome. This is something I try to follow. I use the same concepts that you have listed here. Conforming to the MVC pattern makes it easier to develop. Since my team is using Parse, we don't have to worry about Data Objects and Web Services, but we do have Controllers, Data Managers and Utility functions in our app. I checked out your github account for the HN app and it is a beautifully written one. Great work.

Thanks man, I've been refactoring and learning as I go on that one as well. It used to be not-so-nice not too long ago haha.

Re: Do you worry about the quality of code?

#18
post #12

If I'm working on a homework assignment, yes I go over it a few times and clean it up. If I'm working on our startup, I often google / copy+paste, whatever gets the job done. If I find myself struggling to make it work how I want or I'm spending more time fighting with the code than I'd prefer, I go back and refactor the code.

Yeah, google comes to the rescue more often than not, but I also believe that such code that we put in leads to hacks which may bloat up as messy in the grand scheme of design/structure. For me a good code is something that has proper structure, good mechanism for communication between related modules and maybe, free from hacks :)
Post reply on HN