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
-
SomeNone7135yJust my €0.02:
'Reading code takes time' => absolutely right!
'auto/var' => Most of the time I find that the right-hand side makes it absolutely clear what the type is, and having to uselessly repeat it on the left-hand side just adds noise. There are, of course, situations where stating the type in the declaration makes it all much clearer.
'Ternaries' => Your example is especially silly, and if anyone writes code like that, they deserve a slow painful death. That said, ternaries can be a great tool to make your code more succinct without losing readability, under the rigth circumstances.
'Delegates' => if it's much more than a one-liner, I agree that a separate method/function is more readable.
Learn a functional language such as F#, Ocaml, Haskell, or similar, and your tolerance for terse code with mostly auto-inferred types will grow. In my experience that is also useful for the usual enterprise-y part-OO/part-procedural spaghetti code. -
odite46895y30 seconds to work out what a ternary is? Where the fuck did you fall into your job from?
-
Just use the type the motherfucker said. 7 versions and php just started supporting types btw.
How about you just take the 2 minutes to hover your mouse about the variable in question and look at the tooltip provided by static code analysis™️ and/or hold ctrl or alt (whatever your ide uses) and click on the fucken thing to jump to it's definition.
Nah but you got a point imho. -
@nitwhiz Code Reviews in Plastic SCM or Git or What ever and then its hard to follow. In IDE it is more of a hassle
-
@SomeNone Agree With you. Unfortunately some of the examples were from real code.
-
@FuckJava You should not change A variable multiple times between sequence points. That is undefined behavior
Source: https://slideshare.net/olvemaudal/... -
@odite Trying to follow code flow makes the 30 second mark.
Inside the function there is a delegate function declared (so function in a function)
It is anonymous. so searching for it won't help.
and imagine a case where these are used within each other. there is were the most time is spend
Related Rants
Reading code takes time!
Everytime I read:
"var" or "auto" Add: 10s
- Just use the type
Everytime I read:
if(Expression1 && Expression() ? GetNumber() : 0 > 0) Add: 30s
- Just write two if statements or create two bools the line above.
Everytime I read:
delegate = () => {} Add another 5 minutes of reading time.
- Just write a separate function for it. It helps with searching and understand what it does
Please code like the person that needs to check your code or change it just knows basic coding skills and logics.
I do know all these concepts I just never use them because it makes the code unreadable. hard to follow, mistakes that can happen everywhere. difficult to search.
And it frustrates that I need to read 10 extra lines to understand code flow or hover my mouse in an IDE to figure out what type object it is.
It's properly just me... I just like clean readable code. that is logical and failsafe and strict and deterministic with its behavior
rant
code quality