94

I sometimes write code by first putting comments and then writing the code.
Example
#fetch data
#apply optimization
#send data back to server
Then i put the code in-between the comments so that i can understand the flow.
Anyone else has this habit?

Comments
  • 28
    Comments-driven development
  • 2
    @asgs is it an industry standard?
  • 7
    @xavier666 not a standard, it is sarcastic. And it is exactly orthogonal to what you are doing, which I guess some people are already doing
  • 4
    You're/I'm not alone in this :)
    Extra happy if afterwards I can delete all except the top-most comment (the one explaining 'why' all that had to be done) :D
  • 5
    I did it often when i started learn php; the problem is that this approach lead me to write procedural code, not oop and not easily mantainable in the mid-long term...
  • 2
    Sure, this is how a develop a solution to a tricky scenarios
  • 4
    This is how Morgan Freeman explains stuff 🙄 and yes this I do too
  • 2
    I usually create a diagram on Draw.io for OO projects but this sounds like a pretty good idea.
  • 9
    I put those //TODO: comments.
    They are picked up by the IDE and then I know why I screwed up.
  • 1
    I rather go into more detail in the comments and use that pseudocode for going through the logic in my head. Usually every line of pseudocode evolves into 1-3 lines of actual code
  • 1
    Comments make you boss, most ppl have no clue what they devv
  • 1
    Gonna have to try this soon.
  • 2
    You're so close! Make those tests instead and you'll be doing TDD.
  • 0
    Whenever I tackle a big problem, this is so helpful!
  • 1
    I do -> trying new concept state only.
  • 1
    I just write Main and for each step call another function or interface that does not exist yet...

    So yea if you run my initial code, you'll just get a whole bunch of NullPointer or NotImplementedExceptions
  • 1
    @hendrik draw.io is awesome. Also try out creat.ly
  • 0
    I simply write Main and invoke an as-yet-undefined function or interface for each step.
Add Comment