CS 242 Spring 2012 : Mike’s Rules of Software Engineering

This page last changed on Jan 12, 2012 by conadmin.

Mike’s Rules of Software Engineering

Introduction

What follows is an attempt to condense my years of lessons learned (often the hard way) into a set of simple rules. The hope is that you will find them useful and maybe it will let you learn from my mistakes (instead of your own).

Making a quality product

  1. Quality code is portable, secure, easy to debug, and flexible enough to be used in ways that were never intended. These are not unrelated traits.
  2. Your code will be used in ways you never thought of…plan accordingly.
    1. If this isn’t the case, then you’re probably not writing very good code.
  3. Kludges that we’ll fix in the next release never get fixed in the next release.
  4. If you donʼt do it right this time, you (or some poor bastard that replaces you) will have to do it right later.
    1. It always costs more to do it later.
  5. You wonʼt have any more time in the schedule for the next release.
    1. You wonʼt have any more funding either.
  6. Nothing is free, coupling might save you time now, but it will come at the cost of more time spent on the inevitable rewrite that coupling assures.
  7. Plan as if every programmer who will interact with your code is an idiot. Then you have the worst case taken care of. If theyʼre not idiots then itʼll just be that much easier to use.
  8. Comment your code as if you were going to have to pick it up and use it again in 15 years.
    1. Better yet, comment your code as if you were at the early stages of early onset Alzheimer’s
  9. Your code is not finished until you’ve tested it.
    1. Never assume the other guy tested his code.
  10. Consistency is often more important than doing it the best way. A less than perfect coding practice that is done consistently the same way is usually better than solving the same problem in “better” ways differently each time.
  11. If you can’t settle on one way of doing something, do it both ways and make it a configurable option.
  12. Try to design things so that likely coding mistakes can’t happen (e.g. don’t make the length field in a TLV include the size of the TLV header, or some jerk will not account for invalid lengths).
  13. Clever code is bad. Clever code means it is unclear, non-obvious, or otherwise obfuscated. The benefits almost never out weight the costs here.
    1. On the rare occasions when they do, document accordingly.
  14. Debugging a piece of code is about twice as hard as writing that same code. If your code is as complex as you can manage, youʼre no longer qualified to debug it.

    Time management


  15. Time estimation is really hard…it will take longer than you think it will.
    1. No really, even if you take rule #15 into account it will still take longer than that.
  16. The majority of time spent on a project by developers will not be writing code (go on, keep track of it if you donʼt believe me), it is spent on tasks that programmers are not as good at like debugging, or testing.
    1. Itʼs usually best to turn these non-coding tasks into at least coding assisted tasks. This means writing code to help debug your code (asserts and test routines) and writing code to test your program (regression testing etc). This way programmers that are good at programming can translate some of that into being good at debugging and testing.
    2. You still have to get good at debugging and testing.
  17. The night before its due is probably not the best time to start integrating your code in a large project.

    Working in a group


  18. You can be really good at your job, and a jerk, or you can be so so at your job and a really nice guy…you cannot be a jerk and bad at your job.
  19. In general, meetings are the opposite of getting things done.
  20. Anyone that repeatedly declares things impossible should find their way to your kill file.
  21. In programming, style is substance too. Consistent style improves code readability and makes the code more manageable in the future.
    1. Its less important that a project has the style you like than it is that a project have a consistent style that everyone uses.
  22. Laziness and incompetence are contagious.

    Managing engineers (or being a team lead)


  23. An engineering manager’s job is to do all that is required to ensure that his engineers can do their job. This usually includes keeping his engineers sheltered from politics or any other “outside world” issues, so all they have to think about is coding.
  24. Good engineers are harder to find than most people think, if you have one, do everything you can to keep them.
    1. The same goes for good managers.
  25. Engineers that think lack of documentation is job security should be fired sooner rather than later (otherwise you’ll make them right).
  26. If you force developers to be more accountable for the bugs they cause, then the bad programmers will spend more time fixing bugs, and less time adding more bad code to the project…(a self limiting problem).
  27. A good exercise is to make your engineers swap code with each other…either you’ll get better code out of them, or they’ll kill each other…either way it should be fun to watch.
  28. You get what you pay for. If you think that less skilled or unexperienced engineers will do the same job as more experienced engineers then you are very mistaken. You might pull it off for a release or two, but sooner or later the real bill will come due.

    Using specifications


  29. If it can be made non-interoperable, it will be (e.g. IPSEC).
  30. RFC’s are just a jumping off point to start negotiations; protocols are almost always implemented differently.
  31. Don’t trust any RFC with updates on April 1st (e.g. IPSEC…jerks).
  32. IEEE specs are worse than RFCs.
  33. ITU specs are worse than IEEE specs.

    Open source


  34. Any time you use open source code in a project, be prepared to maintain your own branch of that code. You never know when the developers will get bored and leave you hanging.
  35. Be careful how you mix your licenses. Using GPL’ed code everywhere might speed up your startup’s time to market, but it could all be for nothing if your code ends up being forced into becoming GPL.
    1. If youʼre not adding much to the GPL that youʼre basing your proprietary product on, then sooner or later people wonʼt bother paying for your code at all. You have to have something of value to add.

      The workplace


  36. Beware of anyone in a suit.
  37. The man in charge often didn’t get there by being better than everyone else; keep that in mind.
    1. That doesnʼt change the fact that heʼs in charge.
  38. If you’re made responsible for something (like security) but you are not empowered to make sure it happens, then your real job is to be the person blamed when something goes wrong.
  39. Engineeringʼs job is to find a way to say yes; even if the request sounds (or is) stupid.
    1. If the request sounds stupid try to get to the root of what theyʼre really trying to do, often youʼll find that they are thinking too far ahead of themselves and a simple solution exists.
    2. Saying yes to the project does not mean saying yes to unreasonable or unrealistic timelines or resource allocations. You still have to set expectations appropriately.
    3. Saying yes also does not mean keeping your opinions quiet. If you think they are going down the wrong path, tell them so, but be prepared for the fact that engineers rarely call the shots.
  40. Keep your code for work very separate from your code for personal projects.
    1. Be careful not to use work equipment for private projects either.
  41. Don’t work any harder than you will be rewarded for.
    1. There are many types of rewards, how you define that is entirely up to you.

      Ethics


  42. Don’t ever let your company make you do something you would not be proud of; you may have to work with them now, but you’ll have to live with yourself and your reputation for the rest of your life.
  43. If your company makes a habit of asking you to do something you’re not proud of, find a new job.

    The business of selling software


  44. Management has no idea what the customer wants.
  45. Engineering has even less idea what the customer wants.
  46. If you don’t talk to your customers to see what will make them happy, then sooner or later someone else will.
  47. “Cool” is not a business case.
  48. Demonstrating that your competitors suck isn’t enough to get anyone to buy your product.
  49. Don’t ship anything you’re not proud of.
  50. Never outsource your core competency.
  51. In general, “revolutionary” products, arenʼt.
  52. It doesn’t matter how secure your product is if no-one is willing to use it.
    1. The same goes for just about any feature or aspect of your product.
  53. Chances are your customers/users are not as dumb as you think they are.

    Dealing with a crappy job


  54. “Working from home” doesn’t count against vacation time.
  55. Only listen to the boss that can fire you, the others are just useful for stopping bucks before they hit you.
  56. No-one notices when you come in early, management always notices when you stay late.
  57. No-one cares if you read Wikipedia all day every day if you get your work done on time.
    1. If they do care, find another place to work.
    2. Your best guys probably wonʼt waste most of their time if you gave them something more challenging to work on.
  58. Never commit to anything in emails that you’re not actually committing to, if you must, commit to it over the phone or in person with no witnesses…otherwise learn phrases like “I’ll look into that” or “we’ll see what we can do”.

    General Observations


  59. If its been done before its boring.
  60. Odds are (java/soap/haskell/other wiz-bang thingy) won’t be as revolutionary as you think it will be…C is still alive and well and not going anywhere…so is COBOL for that matter.
    1. That doesn’t get you out of having to keep up with current trends. They might not be a revolution, but they might not go away either.
  61. 1.0 rhymes with “oh no!”
  62. Strive to make a really good 1.0, then move on to other, more fun projects…you’ll still get all the glory for that first project, but you won’t have to do the work anymore.
  63. Use the language that you are most comfortable with, even if its not a perfect fit. Its often faster to make the language fit the developer, than to make the developer fit the language.
    1. You can take this too far, (perl programmers, I’m talking to you!)
    2. This doesnʼt mean that every programmer on the group gets to use their own language. At some point this has to be decided as a group who will use what.
  64. Contrary to popular belief, third party libraries reduce portability of your code.
  65. Open source code is filled with bugs.
    1. Closed source code is even more filled with bugs.
  66. If you’re not getting better, you’re getting worse.
  67. Writing a technical book is way more work than you probably think it is.
  68. Bugs exist in the space between what a program is supposed to do and what a program actually does. There is no such thing as self documenting code. Yes the code tells me what the program does, but it can never tell me what the program is supposed to do. Comments should explain what the program is supposed to do in as much details as the code explains what it really does.
  69. From time to time every rule must be broken; one of the tests of a good engineer is knowing when those times are.
    1. The best engineers know when to break the rules, but they also know how to compensate for the resulting problems (documenting more, making it an idiom, etc).
Document generated by Confluence on Mar 29, 2012 02:55

  1. No comments yet.

  1. No trackbacks yet.