Slashdot Mirror


Ask Slashdot: How Would You Teach 'Best Practices' For Programmers?

An anonymous reader writes: I've been asked to put together a half-day workshop whose title is "Thinking Like a Programmer." The idea behind this is that within my institution (a university), we have a vast number of self-taught programmers who have never been taught "best practices" or anything about software engineering. This workshop's intention is to address this lack of formal training.

The question is, what should be covered in this workshop? If you have an idea -- that also has an example of best practice -- please share!

It's really two questions -- what "thinking like a programmer" topics should be covered, but also what examples should be used to illustrate best practices for the material. So leave your best thoughts in the comments.

How would you teach best practices for programmers?

10 of 220 comments (clear)

  1. Back to basics by Calydor · · Score: 3, Insightful

    Indentation and comments.

    Stopping for a moment to ask yourself if you NEED to load a 50 MB library for two lines of code.

    --
    -=This sig has nothing to do with my comment. Move along now=-
    1. Re:Back to basics by Strider- · · Score: 5, Insightful

      Oh hell no. So-called “self-documenting code” isn’t. You can write the most comprehensible, clear code in the history of mankind, and that’s still not good enough.

      The issue is that your code only documents what the code is doing, not what it is supposed to be doing. You wouldn’t believe how many subtle issues I’ve come across over the decades where on the face of it everything should have been good, but in reality the code was behaving slightly differently than what was intended.

      --
      ...si hoc legere nimium eruditionis habes...
    2. Re:Back to basics by JaredOfEuropa · · Score: 4, Insightful

      The issue is that your code only documents what the code is doing, not what it is supposed to be doing

      Mod this up. I aim to document my intent, i.e. what the code is supposed to do. Not only does this help catch bugs within a procedure, but it also forces me to think a little bit about the purpose of each method or function. It helps catch bugs or inconsistencies in the software architecture as well.

      --
      If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    3. Re:Back to basics by Anonymous Coward · · Score: 2, Insightful

      Don't comment your code. Code your comments.

  2. Re: Learn math by Reverend+Green · · Score: 3, Insightful

    Imho grammar is at least a important as math. If a person speaks like an illiterate rube, chances are he'll program like one too.

  3. Fuck Off With Your Workshop Bullshit by NicknameUnavailable · · Score: 2, Insightful

    The basic summary is: you don't know how to code or you would know it takes a decade of trial and error to get good, even after learning the basics. It's sure as shit not going to happen in a half-day workshop and teaching "best practices" will at most create a zealot who doesn't know what the Hell they are doing and is adamant about not learning. Code workshops don't work, best case scenario you're a lazy low-or-moderate-ability programmer, worst case you're a marketing hack.

    TL;DR: Stop tricking idiots into giving you money, you parasite.

  4. Re:Learn math by Anonymous Coward · · Score: 2, Insightful

    Logic is a branch of mathematics.

  5. Re:Learn math by arth1 · · Score: 3, Insightful

    There is no problem finding good mathematicians that knows jack shit about logic

    Name one.

  6. Re: Learn math by Anonymous Coward · · Score: 0, Insightful

    Programming includes some logic, but it's only a small part.

    Programming is about understanding the effects of decisions from many angles. How a choice will affect correctness, maintainability, and performance.

    These topics are too subjective to be tied to logic. Sadly, this is why programming is still an art.

    Software engineering is an attempt to improve on this, but even those few who are good at engineering are still making their compromises based on their beliefs.

    It's all very fuzzy compared to logic, and using the two in the same sentence is disrespectful to logic.

  7. Re:Learn math by Z00L00K · · Score: 5, Insightful

    Always break down the problem into small parts that are easy to manage and test.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.