128
nikmanG
7y

Steps to writing more readable and cleaner code:
1) write shitty code that gets the job done
2) take a screenshot of set code
3) post it on devRant and blame it on a coworker
4) someone will reply with a clean solution within a couple hours
5) copy and paste that solution then push to repo

Comments
  • 0
    Ahh....
    WHAT.
    AT NOW I'M FEELING SO FRIGGGINGG FRIGGG DAMN BETRAYED

    YOU FRIGGGINGG

    jk
  • 1
    It's my duty tell you, @Floydian, my fellow comrade, I fulfilled the prophecy!

    Edit: it's at https://devrant.com/rants/1377080/...
  • 3
    OR:
    1) Write a unit test for the code you want to write
    2) Make it pass in the simplest way possible
    3) Refactor to make it clean
    4) Write the next test

    Much faster and means you actually understand the solution.
    I know/hope the post is satire but I still thought TDD was worth mentioning ^_^ TDD is always worth mentioning.
  • 0
    Yup
    @CrashOverride
  • 0
    @CrashOverride isn’t TDD more time taking tho?
  • 0
    😂
  • 1
    You high bro?
  • 1
    @OdeToCode not in the long run. You just shift time to the cycle not on bug reports
  • 1
    @CrashOverride yeah just to make the hopes real, it was satire. Just saw like 3 posts in a row where someone actually cleaned the code up for OP.
    And with less sass that SO to boot
  • 1
    @OdeToCode Nope. Sure it may be slow at first while you get used to doing it. But once you get the hang of it your code basically writes itself. I wrote a program to calculate if a number was prime without even needing to think about how to do it. Writing the appropriate test cases in the right order and making them pass one by one led me to the solution.
  • 1
    @CrashOverride well if you say so, I’ll give it a try
Add Comment