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…
It's also worth noting that he's talking about things like "if your client needs a Christmas promotion and you deliver on Dec 29". This sounds about right. But if you're in a time-sensitive situation and your code will only be used for a brief period of time, your business needs are probably very different than a code-and-maintain-forever situation (e.g. a SaaS offering). I am currently developing and maintaining a s…
Your code may be elegant, but mine works
71–80 of 174 posts
Re: Your code may be elegant, but mine works
#72Since reading code is infinitely harder than writing code, the next step that clever coders need to think of is not for themselves, but for others who will continue to work on what they do if they truly want to be working on other new and interesting things.
I haven't found my code gets to be automatically "hacky" if it "works" and isn't obsessed with elegance first. It's usually simpler and approachable by a greater number of decent programmers that can continue on it.
97% of the time the performance worries we have will never come to fruition, software rarely gets that kind of pressure, and very few frameworks (I hope) are that brutal.
Hiding what I do in a clever line of code that slows someone else from improving it, or taking a small 10-40 ms hit for something far more readable and editable. If it's a part of the logic that needs further optimization later, it's ready and willing be improved easily.
One stinking reality is software is just like hardware -- it will always hit its limits and fail. You can be reasonably kind to your future self, but not really prematurely optimize everything before it happens, and instead of making our own lives easier as developers, it should really be about the end users first.
Re: Your code may be elegant, but mine works
#73What is the cost of it breaking? $0? $1,000? $10,000?
What is the cost to fix the broken code?
What is the cost to maintain it?
How much developer time do you waste down the line because they have to fix the "working" code?
I say these things because I've seen this attitude expressed in a large codebase and it sucks a lot to work with and has wasted many hours of developers' lives.
Technical debt is almost never paid back. Just know that going in to whatever you are building.
Re: Your code may be elegant, but mine works
#74The main reason that I agree with this is that developers are, as a group, the boy who cried wolf. It's not that technical debt doesn't matter or code quality doesn't matter but so many developers complain about technical debt and code quality when their concern is irrelevant or flat-out wrong that it's difficult to distinguish a legitimate concern from complete BS. Developers very often use technical debt or doing t…
Re: Your code may be elegant, but mine works
#75There is definite truth in the fact that the decision to minimise (as far as is possible) technical debt accrued throughout a project's journey to release should be carefully considered if the actual, "real world", goal of the project is in some way time sensitive.
However I take issue with a number of statements made throughout the article; Namely:
- "With that said, "best practices," however you define it, should be a natural coding standard for any decent developer". In my experience this is simply not true. A lot of tried and tested best practices (SOLID etc...) are not necessarily intuitive at all. How would I, as an unexperienced programmer, have known that the "new" keyword is often a code smell, if someone had not told me?
- "If the client needs a Christmas promotion, and you deliver the best product in the history of promotions -- on December 29th -- it's worthless". This is true. It is also an exercise in reductio ad absurdum. The author chose an example with a hard deadline, which is unusual. Furthermore, to turn that example on its head:
No Christmas promotion is due to arrive on Christmas day.
It might, instead, be due to arrive on December 1st. If
the outcome of releasing the promotion on time would be
worse than if it was delayed by a week (i.e. The project
had major technical flaws), then delaying by a week would
be the correct decision. This is a decision that business
men/women should make in conjunction with engineers. Is
a working promotion on the 7th of December worth more than
a non-functional one on the 1st? Probably.
Mostly, though, I agree with the idea that engineers should be conscious of the broader "why" & "when" of their work, rather than just the "what" & "how". This is often achieved through communication, which should (IMO) be the true takeaway from articles such as this.EDIT: Obviously being late on a project is never good. This is why contracts should have penalty clauses, which should be factored into the decision I discussed.
Re: Your code may be elegant, but mine works
#76> If the client needs a Christmas promotion, and you > deliver the best product in the history of promotions -- > on December 29th -- it's worthless. Isn't the point to set a deadline that allows the product to be built to a certain standard of quality? If you only ever have time to write untested copy-paste "code that fucking works" then you don't have a problem with your development approach ... unless you're convi…
Just reminded me of a story about the designer Peter Saville (from the film 24 Hour Party People) Tony Wilson: "You've got the posters? It's the fucking gig!" Peter Saville: "Yeah, I know - it just took ages to get the right yellow." Tony Wilson: "The gig's over." Peter Saville: "I know." Tony Wilson: "It looks fucking great actually - yeah, really nice. It's beautiful - but useless. And as William Morris once said:…
Re: Your code may be elegant, but mine works
#77The main reason that I agree with this is that developers are, as a group, the boy who cried wolf. It's not that technical debt doesn't matter or code quality doesn't matter but so many developers complain about technical debt and code quality when their concern is irrelevant or flat-out wrong that it's difficult to distinguish a legitimate concern from complete BS. Developers very often use technical debt or doing t…
Just as developers are often skeptical of a business leader's motivation (is it right for customers or just for his/her ego? etc.), business leaders can be skeptical of technical debt and code quality arguments not because of the concepts themselves but the motivations behind the person doing the arguing.
Re: Your code may be elegant, but mine works
#78I live by a comment Joe Armstrong made on this (from Erlang and OTP in Action): "Make it work, then make it beautiful, then if you really, really have to, make it fast." (The quote continues "90 percent of the time, if you make it beautiful, it will already be fast. So really, just make it beautiful!")
I think we all understand that spaghetti code simply adds time to the next feature we want to introduce, probably creates unseen bugs, and might explode. But it's always a balance and nothing is black and white.
I hear a lot of "you're wrong, do it the right way first!" but you gotta balance "the right way" with its context. Code isn't made for code's sake, it's made to do something (like a business objective, like "be able to order a book through my browser"). Businesses are trying, first and foremost, to make profit, however they need to do that. Beautiful code has nothing to do with that goal, but is sometimes a means to that end.
If the code achieves the business objective it was meant to achieve, it's doing its job (however minimally). Customers don't care what the code looks like (if they look at it). They just care that it does what they need to do (like order a book). Businesses don't care what the code looks like as long as it makes profit.
Secondary to the business objective is how that code fits into the greater context of the system-as-a-whole. Obviously badly written code is going to accrue technical debt, which will likely lead to cumulative delays to new features, cause things to break, etc. The extra effort involved in dealing with that debt is obviously going to cost something, which will have an affect on the primary goal of business: profit. But also delaying a feature, to "do it right the first time", that could be earning revenue, is also going to affect profit. The key is to balance it to maximize profit overall.
When I do anything (code, draw, write, cook, paint, dance, whatever) I start by doing it the simple, easy, fast way; I probably fuck it up; then I iterate and try to improve upon it and refactor. Usually in getting something out there I discover new solutions that I would not have seen had I not actually made something and put it into the world where I could look at it and point to it and talk about it with other people. Being an early mover aside, I think this kind of process helps overall quality anyway. And in the meantime I've got something that's at least doing something.
I think Joe Armstrong knows what he's talking about ;)
Re: Your code may be elegant, but mine works
#79Great article. Note that much of the attitude comes from a belief that what is good for the company is ultimately good for the engineer. However, I'll suggest that's not always the case. Take for example one of the OA's reflections: " Technical debt should be weighted against the actual ROI, because in many cases it is more cost effective to launch early. This way, though you may be accruing technical debt, you are a…
Wish I could upvote you twice.
My company has so much technical debt in the system that we have five people doing the job of three. Technical debt is almost never paid and the result is invariably a big-ass mess.
You might then ask, "well if the company's profitable then what's the effing problem, then?" The answer is that there's a ginormous difference between where they could be and where they are now.
I'm slowly coming to understand that broken is normal. Paying off technical debt can cause your company to mutate superpowers simply because nobody else does it.
Re: Your code may be elegant, but mine works
#80Come on there is a difference between just f * works and works.