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
-
hell165966yHuuaheuhau the code base where I work is so messed up that my boss once in a while rewrite whole systems in a desperate attempt to make things better but he always ends up creating another monstrosity because he has to do that in a hurry...
-
*self-promotion* Well the program this happened to might be on my GitHub profile. Probably only works if you use Windows. Oh well.
-
Mitiko62056yYES!
I had 4 services doing basically the same thing - pulling out an entity from a database or saving it.
I split entities into groups by their properties (taggable, authored, stored (on disk, not the database))
I then wrote a big generic service that took care of most of the work that was repetitive.
I then decided to make blobs authored. I'd have to copy paste from other services, write exception cases... ~30 lines + 1 hour
Me using the generic class - 2 lines (a one-liner split because it was too long) + 1 minute (not counting tests)
I've also had a null exception as I was presetting some entities where the fix would be to literally just switch 2 lines!
If you can implement a feature in just a line, it's probably because your codebase is bloated or you have repetition. In my case different services are OK with doing the same work but on their own databases.
Fixing a bug in a line or two is either just a silly mistake or a a very interesting solution backed by lots of math.
Do you ever just think of a feature you want to implement in your program, thinking it's going to be a challenge and then you realize "oh, my program is set up in such a way that makes adding this feature literally one additional line and one modified line of code, without making the code messy"?
random