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.
66
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. athertonbartelby liked this
  15. ninakix liked this
  16. ericalba liked this
  17. pmcarthur liked this
  18. caseypugh liked this
  19. jameshull liked this
  20. kodewulf reblogged this from marco
  21. yesongaymarriage liked this
  22. tedroden liked this
  23. designage liked this
  24. 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...
  25. 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...
  26. nicolasgut liked this
  27. andybons liked this
  28. morningstar liked this
  29. deadlybrad42 liked this
  30. 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...
  31. marreka liked this
  32. marreka reblogged this from marco and added:
    I completely agree with Marco.
  33. brainofg liked this
  34. madamex liked this
  35. 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...
  36. rebeltechnica reblogged this from marco
  37. mojaam liked this
  38. templated reblogged this from marco
  39. berezina liked this
  40. mokoyfman liked this
  41. mcdavis liked this
  42. mcdavis reblogged this from mikehudack
  43. ragdoll liked this
  44. bewuethr liked this
  45. guillee reblogged this from marco
  46. 2arrs2ells liked this
  47. guillee liked this
  48. reallyreallybig liked this
  49. hammocknotes liked this
  50. yasmary reblogged this from marco and added:
    first time. Marco, thank you. I wish everyone had the same understanding...any code....
  51. Show more notesLoading...
Justin starts a blog

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

Previous Next