16

The key to write the best code is to write it in least lines.

Comments
  • 13
    The consequence is clear: no code, no bugs!
  • 1
    Depends how you look at it, sure using a loop instead of a load of if statements is better (in most cases).

    If you have a short bit of code that does what a few lines of code could achieve then you might not have the readability which would be useful for anyone else that might look at the code later on.

    Again it all depends on what it is but a lot of the time a few extra lines could be worth the readability
  • 1
    @GCHQI think he didn't consider readability, it was more like bragging about. πŸ˜…
  • 0
    Whole program on one line
  • 1
    Ah fair enough πŸ˜‚
  • 0
    @electrineer yeah if you could write it and if the logic is simple enough.
  • 1
    Code should be maintainable by different developers. Therefore, go for clear code before short code always!

    I only agree to this in regards if not repeating yourself, yet I curse a number if colleagues for their habit to have it all in one line.
  • 0
    @k0pernikus agree totally.
  • 1
    @k0pernikus I think most people misunderstand what is meant by keeping code short tbh
  • 0
    @AlpineLinnix I think by readability, @k0pernikus meant that if the code understandable to most coders. Its more like general idea of it.

    However in my experience shorter lines of code generally mean hard to understand but not always, they can be easier sometimes too.
  • 1
    This sounds like not so great advise. Good code is as long as it needs to be
  • 0
    Nope. I don't agree
  • 0
    @hashris that's what people mean when people say that. It doesn't mean make unreadable oneliners.

    It's pretty much just kiss but reworded
Add Comment