Live data from Hacker News

Your code may be elegant, but mine works

omniti.com

21–30 of 174 posts

Re: Your code may be elegant, but mine works

#21
Cache: http://webcache.googleusercontent.com/search?q=cache:zWk8w06...

Actual article text is a bit more nuanced than the linkbait title. I still hate reading sentiments like these because they appeal to the lazy parts of ourselves that don't need any additional encouragement. It's like people revel in their own laziness and failure to follow-through on some things.

Professionals finish the job, regardless of how they feel.

Re: Your code may be elegant, but mine works

#22

"This way, though you may be accruing technical debt, you are also accruing revenue immediately, and you can reconcile the debt over time." The last part of that statement is troubling, because it happens so rarely. I think a lot of devs want to lean towards more engineering "up-front" because they've been smacked repeatedly with the business reality that the first version of that code is what you're going to be stuc…

Yes. "Reconciling technical debt" does not fit in well with the philosphy of the title. Why refactor when you can just write more code that "fucking works".

Of course, those of us with a bit more experience know that a badly designed module can very easily get enmeshed in a system, with the whole system being designed with the bad module's deficiencies being taken into account. Now you don't just have to refactor the bad module, but all of the code around it too, which turns out to be a difficult ask, so nobody does it, and the bad code becomes locked in.

As always, the higher up the software stack you work, the easier it is to justify bad code, but when you are providing infrastructure code, that will be used by applications, you had better be sure that your interfaces are clean, and your implementation stable. Try pushing some inelegant code to the Linux kernel, and you won't enjoy to the experience...

Re: Your code may be elegant, but mine works

#23
Hmm. It's not that I disagree as such, but more that people who talk like this tend to be terrible cowboy coders. But I agree that developers can be annoyingly fussy about things that actually do not matter at all. No argument there.

Plus elegance is often a bullshit notion and when people say it what they really mean is "what I personally like".

Re: Your code may be elegant, but mine works

#25
post #19
post #8

Reducing software development practices down to these cute catchphrases is a bit disingenuous. If you're writing throwaway code for a client with loose constraints and a tight deadline you'll write code differently then you would when you expect to maintain a long term relationship with a client who expects a high degree of correctness. I'm tired of these trite articles espousing some cute mantra holds as if it's som…

Exactly. Specially with the chosen title. Almost all similar articles I read, are used as some kind of self justification to writing bad code and leaving it there forever. If you believe the software will fail (won't ever be changed/grow), do whatever you want with it. If you think it'll succeed, stack too many dirty hacks together and you're gonna pay for it later with tons of interest. Main problem is, too many tim…

> Almost all similar articles I read, are used as some kind of self justification

Nerds (of which I am one) tend to be really good at rationalization. These articles serve as a sort of catharsis ("I probably could have done better, but I was really just moving fast and breaking things!"). Other times, these articles are written as a means of projecting identity (e.g. "I reject enterprise-y nonsense by refusing to doing any sort of analysis or design!")

Both are exceedingly poor motives.

Re: Your code may be elegant, but mine works

#26
post #7

I managed to read the article before it went down, it was a pretty good read. Hopefully it comes back up soon. Anyway it makes a good point that business objectives come before "best practices" which I agree with, but you need to be careful when cutting corners that you don't actually sabotage your business objectives. The real discussion is actually on a risk level: if I cut corner X, I can potentially make revenue…

This estimate gets easier with a couple decades of experience. Which is why I'm always surprised by the agism vibe that sometimes resonates on HN.

Re: Your code may be elegant, but mine works

#27
post #7

I managed to read the article before it went down, it was a pretty good read. Hopefully it comes back up soon. Anyway it makes a good point that business objectives come before "best practices" which I agree with, but you need to be careful when cutting corners that you don't actually sabotage your business objectives. The real discussion is actually on a risk level: if I cut corner X, I can potentially make revenue…

Your equation is quite incomplete. You must add the cost of making the code problem-free without cutting corners... Something like that: Revenue(no cutting corners) - Cost(no cutting corners) < Revenue(cutting corners) * P(no problem) - Loss(cutting corners) * P(problem) - Cost(cutting corners)

Re: Your code may be elegant, but mine works

#28
There's basically just one golden rule: a programmer tries to minimize his total amount of work (because then s/he has more work capability available for any of the more interesting stuff).

This applies to throwaway code vs. maintainable code as well.

In programmer's head there's a running judgement ongoing while crafting something new: there are constant decisions on if cheating with quick'n'dirty hacks is the way of least effort for one part of the software or whether the total effort will be minimised by expending more effort now to do it in a more reusable way that saves effort later.

For example, some parts are just written quickly to test another part more quickly, and that another part might be contained in a module whose interfaces are really worth designing first and coding later. But some of the code inside of that could be replaced by a quick hack for now. Good things and bad things interveawe, interline, and intertwine and in the end just the right places are done perfectly and just the other right places are cobbled together just enough to keep the system together.

We occasionally do misses there, but good programmers have a pretty good hunch on which way to lean at which stage of development and which part of the code.

Re: Your code may be elegant, but mine works

#29
As a database architect I disapprove of this message.

Nearly everything is revisited and changed at some point over the life of the product. If the initial design is a hack or not well thought out, the change will likewise be uglier than the original code.

Even worse, if the original code is not understood by the next developer, it will be thrown out and rewritten.

Take the extra time in the early stages to design, think about fault tolerance, possible future enhancements, extensibility, robustness, reusability, etc. It will pay off.

Yes I over engineer nearly everything I design and yes my deadlines are met. With an elegant design, it is often easier to make late changes on a project. If you follow understood design patterns other people can jump into a project and pick it up right away.

Post reply on HN