Live data from Hacker News

It's OK if your code is just good enough

shiftmag.dev

141–149 of 149 posts

Re: It's OK if your code is just good enough

#141
post #127
post #117

Earlier quoted context omitted.

> better yet create a document you can reference establishing your guidelines. This. Remove as much ambiguity and grey area as possible.

> better yet create a document you can reference establishing your guidelines. How about working on a document that establishes the companies guidelines? I can not imagine having to meet everyone's personal quality bar.

You don't have to meet everyone's personal quality bar, just the person who is in charge of reviewing your code. Write good code and you won't have a problem!

Re: It's OK if your code is just good enough

#142

Things like large functions or code duplication are not necessarily bad in the first place. A far bigger problem that I encounter regularly is the invention of extreme layers of abstraction to avoid a small amount of copy-pasting + edit in the name of DRY. But an even bigger problem is lack of understanding of the problem domain and a lack of documentation on how you plan to fix the problem.

There's more than one way to implement DRY. Lots of times there is no superclassing to capture commonality, but there are functions that can be written only once. Organizing a set of complex algo steps that share some commonality and have some differences is just hard sometimes.

Re: It's OK if your code is just good enough

#144
post #90

Earlier quoted context omitted.

It’s great until there’s some new regulation or costumer requirement and it can’t possibly be added to the monstrosity and so you lose those millions until you can rewrite, which takes months.

Rewriting 5000 lines doesn’t take months. I actually ended up refactoring it in under 24 hours to make it about 10x more reliable and performant (after I put out the immediate fires that had me looking at it in the first place). In general, I agree. I don’t write code that bad, even for prototypes. That said, I worry a lot less about being super meticulous DRY and best practices in my prototypes that in 90% of cases…

Done is not always "better than perfect". A bridge that is done isn't better if it collapses due to poor engineering and kills people.

All software is not life or death. But software can be something people come to rely on.

If I choose (unknowingly) to rely on software not done well and it bites me, I personally would rather not have relied on it at all.

Re: It's OK if your code is just good enough

#146
post #127

Earlier quoted context omitted.

> better yet create a document you can reference establishing your guidelines. How about working on a document that establishes the companies guidelines? I can not imagine having to meet everyone's personal quality bar.

You don't have to meet everyone's personal quality bar, just the person who is in charge of reviewing your code. Write good code and you won't have a problem!

My expectations here were a bit lower, given the individual involved: write code that actually runs.

Re: It's OK if your code is just good enough

#147

> Take a look at the infobip-spring-data-querydsl library. That looks like an absolute nightmare and not an example of very good code.

They have a `FactoryBean`! I always assumed that was just a meme. Must be a serious concept then.

https://github.com/infobip/infobip-spring-data-querydsl/blob...

Re: It's OK if your code is just good enough

#148

Earlier quoted context omitted.

You don't have to meet everyone's personal quality bar, just the person who is in charge of reviewing your code. Write good code and you won't have a problem!

My expectations here were a bit lower, given the individual involved: write code that actually runs.

Ha! I think you might be asking for too much these days!

Re: It's OK if your code is just good enough

#149

Earlier quoted context omitted.

The funny thing with this is, that often times someone’s perfect is someone else’s future headache.

It's more subtle that that. There is a great saying "Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live". I've seen countless bright minds wonder in the pursuit of instant pleasure by adding unnecessary complexity. I have seen others outright sacrificing projects that support people's life to achieve an instant goal of learning a particular library or…

Really? The best peer coders I have met always produced simple solutions straight forward solutions.

So I can not share this experience.

Post reply on HN