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
-
mundo0349116y
-
piehole8106y@telephantasm Disagree a lot... You can spot bad code easily, but it's not as if there's always precisely one amazing solution to every coding problem. Recently, a colleague of mine employed a design pattern that I particularly dislike, and we had a huge debate over it even if the design pattern was executed well. All patterns have advantages and disadvantages.
-
@telephantasm It''s about trade-offs. The same code might be the very worst or absolute best given a certain scenario.
-
aritzh7526y@k0pernikus exactly. Imagine for example you have a program that, for some reason, needs to calculate fibonscci numbers every so often. Would you rather implement a clean recursive algorithm, a more efficient recursive one, or either of them with some sort of caching? Well, the clean code has the good mantainance, but is not efficient. The iterative one is more efficient, but not as much as the cached one, and is not as clean as the recursive. The cached recursive would seem the best, however, it has a memory impact, and in an embedded situation that might be an issue. Always have to take some trade-offs
-
@aritzh fibonacci numbers are very bad example because there is a constant time algorithm (which is the best solution). Recursive algorithm is also pretty much the worst choice there.
-
@aritzh Well, even if it wasn't possible to get the fibonacci number in constant time, iterative algorithm has better time complexity than recursive one. If you were to store previously discovered numbers with recursive one, you could also cache them with iterative algorithm and add single int to store last discovered number. But whatever… I'm nitpicking a bit too much.
Related Rants
Code reviews in a nutshell...
joke/meme
reviews
code reviews
git