Justin starts a blog

Text

Write bad code now, improve it later?

mikehudack:

marco:

Jack Cheng quoted Adam Wiggins’ Order of Operations for writing code:

  1. Make it work.
  2. Make it elegant.
  3. Make it fast.
  4. Make it secure.

I disagree. The biggest problem is that this ignores reality: once it works, how likely are you to go back and make it elegant, fast, and secure? If it’s for personal use, how likely are you to care? If it’s for work, how likely is your employer to be willing to devote resources to “clean up” something that already works? Even the best developers, and the best employers, are pretty bad at this.

You should be writing elegant code very early in the process. There’s always room for improvement, of course, but there’s never an excuse to write sloppy code, even if it’s only running once and you’re the only person ever seeing it.

“Make it fast” can arguably be a lower priority for simple optimizations and constant-time reductions. But algorithmic complexity needs to be considered from the beginning.

And saving “Make it secure” for last seems like a disaster. Imagine how you’d feel, and how you’d even begin to tackle this problem, if someone handed you a pile of another programmer’s code and said, “Make this secure.”

Write good code the first time.

Charles exalts the merits of Red, Green, Refactor development, which is similar. I think it’s OK to make things work first, and then go back and make it fast and elegant.

I agree that security isn’t something that you apply as a refactoring. It’s inherent in the way you design and in the adherence to a methodology. You write secure code because you have a heightened sense of paranoia, both about the users out there, and about the other developers who may come to rely on your code. To apply that paranoia as a refactoring would seem to leave open the possibility of missing things.

via mikehudack
Posted on Thursday, March 19 2009.
67
Notes
  1. shiu liked this
  2. owen liked this
  3. planetelex liked this
  4. notentirely liked this
  5. philish liked this
  6. iheartmyart reblogged this from jackcheng
  7. ruminator liked this
  8. eduardoe reblogged this from marco
  9. mies liked this
  10. gurupanguji reblogged this from marco and added:
    Something I’ve always prided myself in doing and evangelizing within SISL, is do it right the first time. I should also...
  11. gurupanguji liked this
  12. eduardoe liked this
  13. soxiam liked this
  14. ninakix liked this
  15. ericalba liked this
  16. pmcarthur liked this
  17. caseypugh liked this
  18. jameshull liked this
  19. kodewulf reblogged this from marco
  20. yesongaymarriage liked this
  21. tedroden liked this
  22. designage liked this
  23. jakeoliver reblogged this from marco and added:
    1. Drink some coffee 2. Say you’ve got it working 3. Figure out a way it might work 4. Fail to get that working 5. Say...
  24. mcodik reblogged this from caterpillarcowboy and added:
    My guess is that Dave and Marco have different ideas of what it means for code to be elegant. To me, elegant code is...
  25. nicolasgut liked this
  26. andybons liked this
  27. deadlybrad42 liked this
  28. omfgchris reblogged this from marco and added:
    Good code should be written by default as a standard. There’s always room and time later on for improvements, expansion...
  29. marreka liked this
  30. marreka reblogged this from marco and added:
    I completely agree with Marco.
  31. brainofg liked this
  32. justinday reblogged this from mikehudack and added:
    Charles exalts the merits of Red, Green, Refactor development, which is similar. I think it’s OK to make things work...
  33. pixelintelligence reblogged this from marco
  34. mojaam liked this
  35. templated reblogged this from marco
  36. berezina liked this
  37. mokoyfman liked this
  38. mcdavis liked this
  39. mcdavis reblogged this from mikehudack
  40. ragdoll liked this
  41. bewuethr liked this
  42. guillee reblogged this from marco
  43. 2arrs2ells liked this
  44. guillee liked this
  45. hammocknotes liked this
  46. yasmary reblogged this from marco and added:
    first time. Marco, thank you. I wish everyone had the same understanding...any code....
  47. terryblakey reblogged this from marco and added:
    Couldn’t agree more. In the late eighties and early nineties I was producing embedded code for Rolls Royce and Lucas...
  48. sandlex reblogged this from marco and added:
    Agree with Marco. Usually this approach doesn’t work. The same problem with unit test and javadocs in Java - if you...
  49. onigiri liked this
  50. joshkinberg liked this
  51. Show more notesLoading...
Justin starts a blog

nyc. hacker. blip.tv. vegan. drunkard.

Previous Next