Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Sadly lots of people don't care about clean code, they think about current task, it works then we're done.
This will always produce legacy un-maintainable systems which future devs will rant about :)
We should always try to make best out of two (of course working, but clean code needs to be taken into account) -
wait.. clean code and working code arent opposites?
Throw into mix DRY, SOLID and some other paragdims and you end up in broken hell of cleannes.
week ago or so I was DRYing my POC code.
Oh boi, it began to be so difficult to understand what's going on. When I squashed it, I was left no option but either:
-un-DRY it a little
- make really long function names (ie. authUserAndSanitizeInputAndPrepareModelsAndRespondOnFailure())
- make nice short function names where reader is clueless what the actuall fuck that does without digging deeper (ie. prepare() )
so I ended up in starting point but with DRY obfuscation (ended up with mix first and last option and "prepare" ended up "canContinue") -
@DubbaThony DRY can be a little tough to achieve, as for SOLID, I mostly rely on S and O, I try as much as possible not edit already tested classes, and make sure it has its single responsibility. As for DRY, like everyone else I just create a new function that calls the old one, and then do extra work, unless that extra work to be executed at the middle original execution.
That long named functions are annoying and I do what you do, end up having it spread out and repeated rather long bloated names -
@NoMad
But than its anti-DRY
I had it but I had same code in around 10 places.
E:
and worth mentioning it was annoying that in this file that totaled a little bit over 50 lines of code I was having +- 40 lines of repeated code -
@JustThat oh boi, becouse hell, its choice clean or performant. Thats not "influence". Its killer. Take PHP for example. If you have 20 simple classes you could merge into 2 classes there is great chance you will gain much, much perfromance becouse every file counts for IO operation.
And thats just separating files argument, bot to mention abstraction layers etc.
IO is a thing to point where there are "compilers" out there that merge your php code into 1 file (not a joke)
Edit: sorry, i hate unnesesary abstraction layers and thats one of my arguments and it triggered that part of the brain -
@JustThat it helps improve code but its output is.... Not clean by any, any means. Try to navigate on say 1MB file ;)
Related Rants
Working code is not a clean code
rant
code
architecture
clean