6

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

Comments
  • 2
    Just 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.
  • 6
    30 seconds to work out what a ternary is? Where the fuck did you fall into your job from?
  • 0
    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.
  • 0
    how about stream pipelines, factory patterns, etc?
  • 0
    a=++i+++--j++;
  • 0
    @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
  • 0
    @SomeNone Agree With you. Unfortunately some of the examples were from real code.
  • 0
    @FuckJava You should not change A variable multiple times between sequence points. That is undefined behavior

    Source: https://slideshare.net/olvemaudal/...
  • 0
    @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
Add Comment