Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
Books Programming IT

O'Reilly Site Lists 165 Things Every Programmer Should Know (oreilly.com) 234

97 Things Every Programmer Should Know was published seven years ago by O'Reilly Media, and was described as "pearls of wisdom for programmers collected from leading practitioners." Today an anonymous reader writes: All 97 are available online for free (and licensed under a Creative Commons Attribution 3), including an essay by "Uncle Bob" on taking personal responsibility and "Unix Tools Are Your Friend" by Athens-based professor Diomidis Spinellis, who writes that the Unix tool chest can be more useful than an IDE.

But the book's official site is also still accepting new submissions, and now points to 68 additional "edited contributions" (plus another seven "contributions in progress"), including "Be Stupid and Lazy" by Swiss-based Java programmer Mario Fusco, and "Decouple That UI" by tech trainer George Brooke.

"There is no overarching narrative," writes the site's editor Kevlin Henney (who also wrote the original book). "The collection is intended simply to contain multiple and varied perspectives on what it is that contributors to the project feel programmers should know...anything from code-focused advice to culture, from algorithm usage to agile thinking, from implementation know-how to professionalism, from style to substance..."
This discussion has been archived. No new comments can be posted.

O'Reilly Site Lists 165 Things Every Programmer Should Know

Comments Filter:
  • by Snotnose ( 212196 ) on Sunday March 19, 2017 @07:31PM (#54070721)
    Anyone wanna summarize the list so I don't have to read 160 articles to see if I agree/disagree with them?

    That said, I trust O'Reilly to produce quality books. One fail (Make) in maybe 20 books I own from them is a good record.

    / The Gnu make manual is the best Make doc I've seen.
    • by godrik ( 1287354 ) on Sunday March 19, 2017 @07:44PM (#54070771)

      What ? This is slashdot! Since when do we read things before disagreeing with them?!

    • by Anonymous Coward on Sunday March 19, 2017 @08:31PM (#54070893)

      Didn't take me long to start disagreeing with them. This one [oreilly.com].

      I'm sorry, but a program that's thousands of methods and small classes is not clearer than a program with fewer, larger, structures. Yes, write code for Humans, not machines, I agree. BUT remember your other programmers want to understand your program - not any one individual method - so making each method simple only moves the complexity into the interrelationships between methods, something considerably harder to understand.

      (The real failures when other people edit my code usually come in not understanding how classes inter-relate and the layers of the program - the architecture if you will. And at the moment, the only real way of communicating this? Comments describing the architecture.)

      And, do comment your code - not 'as little as possible', but not 'what's obvious from the code'. Remember what's obvious to you might not be obvious to someone else -- write code for humans, not machines. I'm really REALLY not sure that creating another class to hold four parameters for one method is any clearer than just those parameters - especially since I work in languages that support named parameters anyway (a much neater solution)).

      The dead giveaway that this person is full of it is their lack of justification - explain to me WHY the "rule" exists..

      (NB: This is really a collection of 97 micro-essays -- it has, actually, 97 authors - so each author is different.)

      • by geoskd ( 321194 ) on Sunday March 19, 2017 @08:57PM (#54070947)

        I'm sorry, but a program that's thousands of methods and small classes is not clearer than a program with fewer, larger, structures. Yes, write code for Humans, not machines, I agree. BUT remember your other programmers want to understand your program - not any one individual method - so making each method simple only moves the complexity into the interrelationships between methods, something considerably harder to understand.

        What the author was implying is that you should take relatively straightforward components of a function and break them out as their own sub-functions with a very descriptive name, especially the inner workings of nested loops. If you take the inner loop and replace it with a function call that describes what the inner loop does, then your outer loop actually gets much easier to read, as it does not have the distraction of the gritty details of how the inner loop performs its duties. With properly written sub-functions, you can simply read the name and understand what it is doing without having to actually read the function at all. I have personally done code reviews on code that has been re-factored in this fashion, and the readability of the code is night and day.

        • Re: (Score:2, Insightful)

          by Anonymous Coward

          That makes sense if the inner loop is quite large, but not so much if it is small, or the inner and outer loop are very similar (e.g. obviously just looping over a multidimensional array). It doesn't take much for this idea to make code very difficult to read and maintain. I had to take over some code that automated some equipment and at some point we changed the equipment such that a default setting was no longer appropriate. It took two people way too much time to dig for where that default value came

          • Exactly. At the end of the day, legalistically following most "rules" will result in poor code. A good software developer understands when it makes sense to have a longer function or shorter one. They understand when and how to break functionality out. They understand when shorter code is easier to maintain and when longer code is easier to maintain.

            It's hard to point to any particular rule and say that it ALWAYS holds true, though it's easy for us to cite examples of rules that should've been followed in p

        • What the author was implying is that you should take relatively straightforward components of a function and break them out as their own sub-functions with a very descriptive name, especially the inner workings of nested loops. If you take the inner loop and replace it with a function call that describes what the inner loop does, then your outer loop actually gets much easier to read, as it does not have the distraction of the gritty details of how the inner loop performs its duties. With properly written sub-functions, you can simply read the name and understand what it is doing without having to actually read the function at all. I have personally done code reviews on code that has been re-factored in this fashion, and the readability of the code is night and day.

          I disagree. Commenting a code block accomplishes the same thing and "distractions" reasoning for taking up a few more lines on a page is of unconvincing value and probably dangerous. What IDE does not allow you to collapse by scope? For all you know someone may discover an important side-effect by actually noticing structure of intervening code. When you replace comments with function names then function names also risk becoming as stale and dangerous to believe as comments.

          My personal view organizing

        • If you take the inner loop and replace it with a function call that describes what the inner loop does, then your outer loop actually gets much easier to read...

          Nice idea when things happen to factor that way. But often they do not, and the additional glue you need to factor out the inner loop adds more obfuscation than it removes. The takeaway is, just don't be mindless about factoring techniques.

        • It also helps to get old and have your memory fade. If you don't follow good naming conventions it is hard to understand what you wrote yesterday.
      • I'm sorry, but a program that's thousands of methods and small classes is not clearer than a program with fewer, larger, structures. Yes, write code for Humans, not machines, I agree. BUT remember your other programmers want to understand your program - not any one individual method - so making each method simple only moves the complexity into the interrelationships between methods, something considerably harder to understand.

        Actually, I agree with the author on this one, but the title is wrong. It should be something more like: "Write your code under the assumption that dozens of mediocre programmers will be eventually responsible for maintaining it."

        This "thousands of 15 line methods and small classes" approach is the only way that we know of, so far, to scale up codebase to dozens or even thousands of mediocre programmers. It sucks, but really good programmers are hard to find.

      • I don't disagree with that one.

        Picture a program as a huge collection of LEGO bricks and pieces, and understanding the program implies understanding how the LEGO parts are being used.

        What is easier to understand, one huge box full of LEGO bricks along with a very long instruction manual explaining all of the contents, or having the LEGO bricks neatly divided into smaller packages along with shorter instructions that focus on the contents of each individual package?

        Of course, the big advantage of the latter

      • And at the moment, the only real way of communicating this? Comments describing the architecture.

        A few years back I started incorporating UML diagrams [smartdraw.com] into my design process. So before I start coding I draw out the architecture of the program, and this becomes part of the documentation. I find this useful for my own planning purposes to prevent constant refactoring, and if I need to explain the program to someone else, a picture is worth a thousand words.

      • by pruss ( 246395 )

        This works especially well in languages where you can have a function whose definition is within the scope of a function. Then all the functions are guaranteed to be together in the source, and with their containment relationships obvious to the human reader. If one changes an inner function's functioning, one only needs to check in one place--the outer function--for how this affects things.

    • by AHuxley ( 892839 )
      "Know Your Language"
      http://programmer.97things.ore... [oreilly.com]
      "Learn the Platform"
      http://programmer.97things.ore... [oreilly.com]
    • by JustAnotherOldGuy ( 4145623 ) on Sunday March 19, 2017 @10:52PM (#54071305)

      Anyone wanna summarize the list so I don't have to read 160 articles to see if I agree/disagree with them?

      1) Don't do stupid shit.

      2) Think ahead.

      3) Don't reinvent the wheel.

      • Don't do stupid shit.

        I am sure this is a sound advice that actually helps people improve their behaviour. </s>

        • Don't do stupid shit.

          I am sure this is a sound advice that actually helps people improve their behaviour. </s>

          It's helped me and countless others, but it won't help the terminally stupid.

      • by grep -v '.*' * ( 780312 ) on Monday March 20, 2017 @06:32AM (#54072287)

        Anyone wanna summarize the list so I don't have to read 160 articles to see if I agree/disagree with them?

        1. THE ROBOTS ARE COMING -- find a different job.

        • Programmer is the safest job. Somebody has to program the robots.
          When the robots learn to program themselves, well, then we have reached the end of human civilization.

      • Oh, except for:

        72. Reinvent the Wheel Often by Jason P Sage

        Beware the 'catchy' titles. This one happens to sum up to "if you reuse some code, you won't have intimate knowledge of it and will just consider it a black box". It's not made especially clear why that's such a bad thing though.

  • Pair Programming (Score:4, Informative)

    by Anonymous Coward on Sunday March 19, 2017 @07:36PM (#54070739)

    Not sure "pair programming" qualifies as something every programmer should know. Though perhaps every programmer should know that a few programmers are rather fanatical about it.

    • Not sure "pair programming" qualifies as something every programmer should know. Though perhaps every programmer should know that a few programmers are rather fanatical about it.

      Knowing it doesn't mean you need to practise it.

      The list is basically a giant list of suggestions and perspectives, not every one is applicable to every situation, but knowing the list means you have a much better chance of knowing the ones that are applicable to your situation.

    • by TechyImmigrant ( 175943 ) on Sunday March 19, 2017 @08:23PM (#54070863) Homepage Journal

      Pair programming sounds horrible and I'm glad I don't have someone staring at my screen while I'm trying to slack off and read Slashdot.

      • Re: (Score:2, Insightful)

        by Anonymous Coward

        ... trying to slack off ...

        It's called, interrupting job tasks to prevent boredom and burn-out.

        ... read Slashdot.

        That's gaining external perspectives on important issues; which is the very point of 97 Things Every Programmer Should Know.

    • Pair programming works better when you have the opposite sex sitting on your lap.
  • by Crashmarik ( 635988 ) on Sunday March 19, 2017 @08:33PM (#54070899)

    Depends which do you think you can recreate faster as you need them.
    Small Unix Tools using the IDE
    or the Large IDE using small Unix tools.

  • by tobiasly ( 524456 ) on Sunday March 19, 2017 @09:07PM (#54070973) Homepage

    "Be Stupid and Lazy" sounds a lot like Lary Wall's "Three Great Virtues of a Programmer: Laziness, Impatience, and Hubris" http://wiki.c2.com/?LazinessIm... [c2.com]

    Of course, maybe the "Be Stupid and Lazy" author was just being lazy :)

  • by __aaclcg7560 ( 824291 ) on Sunday March 19, 2017 @09:24PM (#54071021)

    This week I had to install Ant to automate some Python programming tasks. Of course, Ant requires Java. I haven't touched Java since I graduated from community college 10 years with an A.S. degree in computer programming and had to learn all flavors of Java because the CIS department couldn't afford to renew the Microsoft site license for Visual Studio, and, when the site license got renewed, none of the computers could run VS .NET. I really wanted to learn C++ instead of Java, but industry surveys showed that local employers wanted VS C++ and not GNU C++.

    Anyway, Ant renewed my interest in Java. Any good O'Reilly book to get back into that language?

  • Do Lots of Deliberate Practice ... "It takes elite performers a minimum of 10,000 hours of deliberate focused practice to become experts."

    The quote about deliberate practice is taken out of context.
    1) It is said it typically takes 10,000 of deliberate practice to become "elite", but it can take as few as 100 hours for those "naturally" good at something
    2) This mostly applies to professions where practice matters, like playing an instrument. As a profession becomes less about muscle memory and more about thinking, practice becomes less useful.

    Becoming an elite in a purely intellectual profession can require virtually zero practice. Some p

    • by MrKaos ( 858439 )

      Rule of thumb, don't write any code until you understand the problem and have thought of a good solution.

      Are you suggesting people think *before* they code. How Dare You._howdareyou_.

      Seriously though sometimes I write a prototype knowing I'm going to throw 90% of the code away, I just want to know where the hard problems will be before I invest too much in anything else. Sometimes you end up with a few gem ideas that you can refine.

      • by Bengie ( 1121981 )
        You know that you're going to throw away most of the code. Most people don't see a prototype meant as a learning experience, they instead see "working" code. All working code is equal in their mind. Except they don't actually know how it works, it only seemingly works. You can tell they don't know how it works when something finally goes wrong and they can't even guess as to why it's not working.

        One of my rules of thumb is "You can't know why your code doesn't work unless you first know how it works.". 80
  • by russotto ( 537200 ) on Sunday March 19, 2017 @10:39PM (#54071267) Journal

    The Professional Programmer

    What is a professional programmer?

    A professional programmer is someone who gets paid to do the job of programming.

    Professional programmers take responsibility for their career, their estimates, their schedule commitments, their mistakes, and their workmanship. A professional programmer does not pass that responsibility off on others.

    Sorry, bud, but professionals take responsibility for what they're paid to take responsibility for; no more and no less. And push responsibility off when appropriate too, like when their boss commits them to a schedule they can't make without compromising workmanship.

    If you are a professional, then you are responsible for your own career. You are responsible for reading and learning. You are responsible for staying up-to-date with the industry and the technology. Too many programmers feel that it is their employer's job to train them. Sorry, this is just dead wrong. Do you think doctors behave that way?

    Hell, yeah, they do. What do you think a resident is? Maybe the author is confused because after residency, many doctors are owners of their own practice, at which point they are not just professionals but business owners. Me, I draw a salary. If my training is going to benefit The Company, it's on The Company to provide it.

    Professionals take responsibility for the code they write. They do not release code unless they know it works.

    Again with the confusion between a professional and someone with independent authority. My code goes out when the boss says it goes out, ready or not.

    Professionals are team players. They take responsibility for the output of the whole team, not just their own work.

    Obviously not familiar with life in a corporation. Managers and leads take responsibility for the output of the whole team, when that output is good. When things are fucked up, THEN the programmers get the responsibility. Shit flows downhill, credit is taken upward.

    Professionals do not tolerate big bug lists.

    Professionals fix those bugs, and only those bugs, they're being paid to fix. The rest can sit in the issue tracker until doomsday. Ain't no point in getting the boss riled up over spending time fixing a minor floating point division error when you're supposed to be working on the shiny new feature.

    Professionals do not make a mess. They take pride in their workmanship. They keep their code clean, well structured, and easy to read. They follow agreed upon standards and best practices. They never, ever rush.

    A professional rushes when being paid to rush. A professional keeps the code clean when practical under the constraints of the job. If that means we're getting the code out on time only with a bunch of copypasta and a goto or two, that's how it's going.

    Professionals get paid. If they have a rare combination of independent authority and a client with respect for them, maybe they can have other principles too. Otherwise, they write the code which gets them paid.

    • by MrKaos ( 858439 )

      This comment is exactly what a professional programmer would say.

      Pay for my own training on some arcane system where there is no return on my investment, "If you pay for it" - That is what a professional programmer would say. Personal responsibility for the things I'm responsible for. Responsibility without leadership is another term for 'punching bag'.

      So, fuckin A, mod parent up and up for such a professional comment.

    • by nasch ( 598556 )

      Too many programmers feel that it is their employer's job to train them. Sorry, this is just dead wrong. Do you think doctors behave that way?

      My wife is a certified nurse-midwife (same level as nurse practitioner, basically a step below MD) and her employer pays for her continuing medical education. Maybe he should stick to talking about programming and programmers.

    • by mark-t ( 151149 )

      You may be a professional, but if I may be frank on the matter, you come across as having the attitude and work ethic of a rank amateur. I've sat in at interviews with would-be colleagues who demonstrated similar attitudes, and thankfully none of them ever got hired on. I have also had the misfortune of working with a few that I did not sit in on the interview with, and in my experience, they move on quickly, rarely sticking around with any one company for more than about a year or so.

      So yes.... you mi

      • So yes.... you might get paid, but if you don't have enough of a passion to do what you get paid for

        It is passion that is the mark of the amateur; the word is derived from the Latin for "love", after all.

        To a professional, passion is dangerous, it leads to doing things that aren't remunerated.

        then odds are going to be that you will be passed up for promotions

        Ah, but promotions in this profession are a simple and spare thing. You work a few jobs, eventually you start calling yourself "Senior". After that,

        • by mark-t ( 151149 )
          There's a funny thing about money.... beyond a certain point past once mere survival ceases to be an issue (and if an employer is treating employees fairly and paying them what they should be worth, then this is most definitely an achievable thing, at least in this industry), you actually stop caring about how much more you can get. You get to have the luxury of caring about how good the work you do is *beyond* what that might mean to you financially because in the end, it isn't money that is going to giv
      • Whoa, so much hot air you could fly a blimp across the Pacific on it.

        Professionalism isn't about staying at a job that doesn't pay your worth.

        And with your attitude regarding requirements and salaries, you only qualify as a professional con artist.

    • I sort of agree but I think you're being a bit too defensive. It is the job of the professional to explain the importance of clean code, fixing bugs etc to your boss. After you, as a technical specialist, has explained the importance of doing things the right way, it is up to your boss to make the business decision of playing safe or taking a risk. Often, risks are not just in the code. If the release is delayed (again), the customer may loose confidence (again) and leave. It is the job of the boss to weigh

    • by ath1901 ( 1570281 ) on Monday March 20, 2017 @05:53AM (#54072185)

      You are responsible for reading and learning. You are responsible for staying up-to-date with the industry and the technology. Too many programmers feel that it is their employer's job to train them. Sorry, this is just dead wrong. Do you think doctors behave that way?

      I just can't stop thinking about the stupidity of this.

      Doctor: Hey, patient, would you like to try some new meds I read about on the internet yesterday while my kids were screaming? I haven't tried them or read any scientific studies and I am unsure about the use-case compared to existing drugs but they are very popular in some facebook groups.

      Navy Officer: Hey, we're getting a new aircraft carrier next year so I expect all of you to go home and read up on it and start practicing at home. We'll call you when there is a war and your skills are needed. You'd better be self-trained experts by then!

      University head: What's all this "research" I keep hearing about? Take some responsibility for your own careers and stay up to date in your spare time! Now, go back to work. We need more folded napkins!
           

      • Agreed. The field is just too large for people to have *any* chance of keeping a useful handle on what is going on. You are going to have to specialise. The trick I think is to know what you don't know, not to keep up with everything. I was recently asked by a potential client if I could produce a mobile phone app for them - 'no chance, i'm not competent at that' was my reply. I pointed them at someone who specialises in this work. Knowing what you don't know (and who does!) is a much more useful skill than

  • by Anonymous Coward on Sunday March 19, 2017 @10:46PM (#54071279)

    I just f*** love it when the lowly programmers were asked to take "personal responsibility" when everyone else who earned more and have more authority, such as managers, wouldn't.

    Where's the guy taking "personal responsibility" for the requirements document, which changes weekly/daily?

    Where's the manager taking "personal responsibility" when the project have to keep going on the original schedule even when short staffed?

    Where's the PM taking "personal responsibility" when unreasonable death march schedule was accepted?

    So when sh*t hits the fan, the *programmer* should take "personal responsibility"? You think we were fools?

  • Start lists with an index of zero.

    • I would say "start lists with the index that's the convention for your programming language." And the only language I know of off the top of my head that uses a starting index of 1 is Visual Basic, and if you're using VB you should probably just kill yourself.

  • I would think that the first thing a modern software develop should know is to decouple interface and logic and data. This is nothing new.

    Composite/Structured Design was published way back in the late 1970' and detailed how rules should be in one place only as well as touching on the interfaces to access data and rules. Apple used the MVC structure to separate data from the viewer and methods. OO programming made this much easier to do. Computers are so fast any penalty, in most cases, is irrelevant.

  • The Road to Performance Is Littered with Dirty Code Bombs [oreilly.com]

    Unexpected encounters with dirty code will make it very difficult to make a sane prediction.

    Dirty code is defined as ' overly complex or highly coupled.' As a programer you are expected to deliver X number of features by Y date. Unless one of those features is 'simple and loosely coupled code' what does that have to do with predicting anything? For performance you don't predict. Experiments are the only thing you have that work: test and change an

  • Production server (Score:5, Informative)

    by nasch ( 598556 ) on Monday March 20, 2017 @01:28AM (#54071689)

    Under no circumstances — ever, at all — should a developer have access to a production server.

    I'm one of two developers on a five person team. The other people are: CEO/sales, marketing/customer support, and QA. If I didn't manage the production server, there would be no releases. Perhaps this would be more accurate:

    Under no circumstances — that I've personally experienced — should a developer have access to a production server.

    • by Dog-Cow ( 21281 )

      No. Just because you're doing it wrong doesn't mean the advice is invalid. Now, just because you're doing it wrong doesn't mean that you can do it right. I assume there's a financial reason for your setup. But you're still wrong.

    • by coofercat ( 719737 ) on Monday March 20, 2017 @08:33AM (#54072729) Homepage Journal

      The real advice is that "while working in the role of Developer, do not have access to the prod servers". If you additionally have the role of "sysadmin" from time to time, then so be it, but don't abuse your development power, nor your sysadmin power.

      In my experience of big companies, small companies and a few in between this really does work best. People talk of 'creating high walls' and whatnot, but by forcing devs to mould their output into something system-friendly results in a far superior product and far less maintenance overhead. It appears to take longer to get things into production, hence the 'high walls' comments, but the alternative is almost always worse in the long run.

  • Was going to suggest Urdu, but it's already there at number 49.

  • Some of these "things every programmer should know" are just wrong. They are wrong from their observations, their non sequitur conclusions, and their misunderstanding of computer science.

    BAH!

    • [...] and their misunderstanding of computer science.

      But not every programmer has studied computer science.

      • [...] and their misunderstanding of computer science.

        But not every programmer has studied computer science.

        OMG, then they should not be working in the field. Computer Science is what we do.

        • Actually, no, what lots of us do is solve real world business problems by automating them using computers. Knowing what the business problem is is just as valuable as understanding how computers work, and you can approach the solution from either direction - neither is implicitly better than the other.

          BTW, I'm a CompSci, but I work with Physics Phd types who understand the problems I work on better than I ever will, and we have complementary skills.

        • OMG, then they should not be working in the field. Computer Science is what we do.

          I can't imagine too many CS graduates who want write a PowerShell script to ping 80,000+ workstations and output the results to an Excel spreadsheet.

Chemistry is applied theology. -- Augustus Stanley Owsley III

Working...