12

Hypothetical Question:
Write a complex code to make it efficient Or
Write a simple code so that the next developer who works on it understands the code easily.

Comments
  • 8
    Write elegant code that is both easy to understand, and is optimized and efficient. They are not mutually exclusive.
  • 5
    Write code with documentation not with attitude 😌
  • 2
    Depends on what you're writing.
    A trading platform needs to go for as efficient code as possible, no matter how ugly it looks.
    A report builder needs to be more maintainable, and a tiny bit of extra processing time is worth it for the ease of changing a report later.
  • 3
    Keep it clear until you hit a bottleneck: Then optimise it if needs be.
    But clear code can still be optimal. Don't assume that if it's easy to read that it's slow..
  • 0
    Write the simple code. Time it, profile it. Optimize if slow. Complexity can be worth it but i like to prove its worth it.

    Usually i stop at "write the simple code" because when i dont and a bug appears, i have to write the simple code again anyway to figure out what i did wrong.
  • 0
    Comments might be nice.
  • 0
    Write efficient well document code. Then it won't be complex anymore!
  • 1
    @Fiftyseven welcome to devRant! Have your first ++. It is Very possible to write elegant, efficient code. Anything else is just being sloppy. 😉
  • 1
    First write clear and simple code. It's simpler to test it with unit tests.

    Then optimize it till you can still read it.

    If it is a must to be efficient more than readable and extensible, then write documentation. Really really good.
  • 2
    @iAmNaN Thanks bro! Long time lurker, figured it was time to start posting!
Add Comment