Slashdot Mirror


How to be a Programmer

Martin L. Smith writes "Rob Read has posted his magnum opus, "How to be a Programmer: A Short, Comprehensive and Personal Summary" to Samizdat Press where it can be scarfed by the masses. Rob's book is a forty-page tour through the million-and-one things he thinks a programmer ought to know as he sets out into deep water. One of the reasons he posted this was to get some feedback, so tell him what you think. Samizdat Press is maintained by the Colorado School of Mines to provide a distribution point for free (mostly earth-sciences related) texts."

43 of 420 comments (clear)

  1. We got it by mao+che+minh · · Score: 5, Funny

    I think that 90% of the people here already have the whole "how to thrive in a seclusive career path that is extremely difficult to find employment in and you end up having very little contact with the softer gender" thing down pat, thank you very much.

  2. How to program in the 21st century by Anonymous Coward · · Score: 5, Funny

    1) Write a spec
    2) Send spec to Indian/Russian/Chinese Programming Outsourcer
    3) ...
    4) Profit!

  3. just a thought by Anonymous Coward · · Score: 4, Insightful

    ok, i just skimmed a couple lines of this thing but it seems to that he glosses over some major areas: "Idealists may think that design...is more fundamental [than debugging] but they are not working programmers." IMHO it's nearly impossible to implement a major system without doing some serious design work first - debugging can fix logic errors, but not design flaws.

    1. Re:just a thought by SirSlud · · Score: 5, Insightful

      In the real world, if you're designing large systems, you're not a programmer, youre a systems architect.

      Think .. architects design the huge thing .. programmers build it, and make localized design decisions.

      But I dont think its fair to say programmers must be good at large scale design since thats a career path unto itself. And those who can design large scale systems are usually not so good at the nitty gritty ... so I think your point is more one of semantics.

      --
      "Old man yells at systemd"
    2. Re:just a thought by oconnorcjo · · Score: 5, Insightful
      But I dont think its fair to say programmers must be good at large scale design since thats a career path unto itself. And those who can design large scale systems are usually not so good at the nitty gritty ... so I think your point is more one of semantics.

      I totally DISAGREE. Good programmers have a total picture of how thier programs work and interact and that is why they work and interact very well (the nitty gritty is done with a debugger and testing). If a system architect was not at one time a very good programmer then he is probably a bad system architect. Of course thier are tons of bad programmers who then become bad system architects FWIW.

      --
      I miss the Karma Whores.
    3. Re:just a thought by Coz · · Score: 5, Insightful

      Since I'm doing that "system architect" job at the moment, I feel like I can reply to this :->

      If I didn't have years of prior experience hammering systems together, debugging custom code and off-the-shelf things made to play together in new and unforseen circumstances, and a few tens of thousands of lines of multiple languages of coding, I wouldn't be able to avoid the land mines that the folks who designed THOSE systems subjected me and my "tribe" to.

      One of the glaring gaps in the last 15 years or so has been the one between the classic "system engineers" and "software engineers". The "System Engineers" have usually been hardware types, and have no problem saying "it's a software problem - deal with it" and making the poor code monkeys cope with their bad decisions. It's taken me years to get the credibility among those folks to make them listen to my opinions and actually change their minds; I was just a software guy, not a Systems Engineer. Now, I have a program manager who's former software, and a software manager who's former software, and I'm senior to our chief system engineer :-D. I can't dictate, but if it doesn't fit in with my architecture, I have a veto - and I'm consulted on every technical decision that's not already delegated to someone for implementation (I review those).

      This may actually be my dream job - fortunately, we're doing well on it, so we're thought of well inside the company; unfortunately, we're meeting our schedules, so it'll end within the year *sniffle*. Then, I'll just have to find a way to keep myself out of management....

      --
      I love vegetarians - some of my favorite foods are vegetarians.
    4. Re:just a thought by Citizen+of+Earth · · Score: 4, Insightful

      IMHO it's nearly impossible to implement a major system without doing some serious design work first - debugging can fix logic errors, but not design flaws.

      I find that a very effective way to discover and fix design flaws is to try to implement them. A two-year PowerPoint exercise doesn't always do this.

  4. I wonder what will be in this book... by anactofgod · · Score: 5, Funny

    That one can't learn from reading Dilbert and watching Office Space.

    "Why didn't you put a cover sheet on the TPS report!" - "Terrible" Terry Tate.

    --

    ---anactofgod---

    "Equal opportunity swindling - *that* is the true test of a sustainable democracy."
  5. Nice read, one thing that is missing... by arf_barf · · Score: 5, Insightful

    How to deploy the software and updates to it.

    It gets quite complex in custom business applications where you have to distribute client, middle tier and database updates to production systems.

    Anyhow, my 2 cents.

    1. Re:Nice read, one thing that is missing... by homebru · · Score: 4, Funny
      ...deployment is really neglected.

      Maybe, maybe not. Very often the programmer is not a part of the deployment process.

      In very small companies, the owner waits until the programmer is not in the office and then copies executables from the wrong directory on the development machine onto a floppy/tape and starts sending out copies in order to make good on the ridiculous ship date the programmer refused to accept. This complicates the finger-pointing to come, since the marketing/sales manager did the same thing three days earlier. [If you haven't experienced this, you simply haven't worked at sufficiently small companies.]

      In very large companies, programmers can't be trusted anywhere near the QC, release, or production environments. At best, the programmer is allowed to create a release document listing the files to be compiled by the "build-meister" in the sterile build environment and then tar-balled for delivery to the sysadmins. Who will "install" by dropping the tar-ball into /usr/local/bin, turning off their pagers, and going home. [If you haven't experienced this, you simply haven't worked at sufficiently large companies.]

      It wasn't funny at the time.

  6. The short list by mighty_mallards · · Score: 5, Insightful

    Here's what is important to me as a programmer:

    1. Always keep learning - it's not as important how much you know - it is important how fast you can learn new things

    2. Don't just implement something for the sake of doing it, or because it will look cool on your resume. Make sure you have valid reasons for what you do, preferrably backed up by some research. Change isn't bad unless it is change for the sake of change.

    --
    You find this humorous, centurion?
    1. Re:The short list by jgerman · · Score: 5, Insightful

      Err 1 and 2 are kinda mutually exclusive. Additionally, as far as I'm concerned and backed by experience, people who do 2 tend to be the better programmers. People who dabble in CompSci because they love it, and write code for the sake of writing it, are not only more experienced, they're also more willing to try new things, and have a better understanding of the field.

      --
      I'm the big fish in the big pond bitch.
  7. Programmer? by rela · · Score: 5, Insightful

    This looks like it should be titled "How to be a Developer", as much of it is oriented towards programming for a project or coporation...

  8. He left out a certain chapter by TerryAtWork · · Score: 5, Funny

    The 'Thrown Out Like an Old Sock' chapter.

    --
    It's Christmas everyday with BitTorrent.
  9. how to be a "successful" programmer by C60 · · Score: 5, Funny

    1) Write code
    2) Avoid commenting your code at *all* costs
    3) Obfuscate code, heavily and often.
    4) Make sure everyone sees your code. This will culture a sense of fear and awe in your coworkers. Particularly if you can make your Perl code look like assembler.

    With these 4 easy steps, you too can be one of the last people to be laid by your employer!

    --
    Karma: 0 (But I wield a mean +10 Vorpal Apathy)
    1. Re:how to be a "successful" programmer by rela · · Score: 5, Funny
      With these 4 easy steps, you too can be one of the last people to be laid by your employer!

      Mere typo, or Freudian slip?

    2. Re:how to be a "successful" programmer by Anonymous+Brave+Guy · · Score: 4, Funny

      Nah, that was a Freudian slap. A Freudian slip is when you say one thing and mean your mother.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  10. How To Write Unmaintainable Code by joe_bruin · · Score: 5, Funny

    just read this handy guide to writing unmaintainable code and do exactly what it suggests

  11. My advice... by JaredOfEuropa · · Score: 5, Interesting

    There is no substitute for experience, but there is something resembling a fast track.

    Get paired to a senior programmer/systems engineer

    If you have the opportunity to work with a senior on a one-to-one basis, grab it with both hands. There will not be many times when an experienced guy is willing to work with you or coach you, so rejoice when the opportunity presents itself, take it. A colleague of mine asked me which project he should take: a glamorous one where he would be working in a large team with no coaching, or a boring-looking but difficult job, working under one senior programmer. I adviced him to take the latter... which he did, and while he often complained about the job itself, his programming skills improved by leaps and bounds, which made him a senior programmer on the next assignment. I was glad to see he has taken it upon himself to teach in the same manner and spend lots of time with the junior guys.

    --
    If construction was anything like programming, an incorrectly fitted lock would bring down the entire building...
    1. Re:My advice... by homebru · · Score: 5, Insightful
      ...what advice would you give ...

      You only need to stay 15 minutes ahead of the others for them to think that you are a genius.

      Several things you can do:

      • Create a small version of your development environment at home and spend time doing little proof-of-concept projects there before announcing your design ideas at the office. Even if people find out that you are proofing at home, you can get points for having a Give-A-Shit attitude.
      • Write up your thoughts/notes on the current project and give them to the new kid in the group. S/he will become conditioned to come to you for answers. Which will force you to learn.
      • Call meetings of the programmers to talk about shop standards, techniques, "how to use GDB", etc. Nobody else is trying to form the herd into a team and you will look like a leader. Which will force you to become one.
      • Teach classes to the other programmers. Managers love to get department training for effectively nothing. An AS400 jockey could try to explain OS400 (is that the right name?) to UNIX jocks. A UNIX type could intro Linux to the 400 jockeys. You really find out what you do and don't know when you try to teach someone else.
      • Get a copy of some presentation tool (power-point equiv.) and learn to do simple presentations. Ten pages or less; outline form; major bullet points. Then use those techniques in your peer meetings. Scare the bejeezus out of your manager by using a formal presentation to explain why you HAVE to have some new tool in the department. You'll know you have "arrived" when your boss uses your presentation to go to his boss for more budget money.


      Get the idea? Learn by doing privately and learn more by teaching. To be really great, you need more than coding skills. You also need writing, teaching, leading, and public-speaking. But most of all, don't try to do it in a vacuum. You can learn from others while you are teaching them. You can't get there overnight, but by constantly picking at it, one little piece at a time, you will get there.

      Downside is that marginally-abled management will see you as a threat to their jobs.

      p.s. For goodness sake, learn to punctuate and use a spell checker. (No touchbacks.) You don't get points for looking professional; you lose for not.

  12. How to be a programmer by Anonymous Coward · · Score: 5, Funny

    Choose no life.
    Choose no natural light.
    Choose cafeine.
    Choose to have RSI.
    Choose no girlfriend.
    Choose to work long hours and the weekends.
    Choose to use C.
    Choose to use JAVA after talking to the boss.
    Choose to have a bloody big 21 inch monitor.
    Choose to comment code.
    Choose to have to comment other people's code.
    Choose to run a sourceforge project on the side.
    Choose to be abused by mindless helpdesk jockeys.
    Choose Comp Sci.
    Choose D&D geeky friends.
    Choose Slashdot.
    Choose an early grave.
    Choose something else.

  13. Tao of Porgramming by axxackall · · Score: 5, Funny
    This classic translation takes care about the spirit of programming.

    Just few quotes:

    Does a good farmer neglect a crop he has planted?
    Does a good teacher overlook even the most humble student?
    Does a good father allow a single child to starve?
    Does a good programmer refuse to maintain his code?

    There once was a master programmer who wrote unstructured programs. A novice programmer, seeking to imitate him, also began to write unstructured programs. When the novice asked the master to evaluate his progress, the master criticized him for writing unstructured programs, saying, ``What is appropriate for the master is not appropriate for the novice. You must understand the Tao before transcending structure.''

    The Tao gave birth to machine language. Machine language gave birth to the assembler.

    The assembler gave birth to the compiler. Now there are ten thousand languages.

    Each language has its purpose, however humble.
    Each language expresses the Yin and Yang of software.
    Each language has its place within the Tao.

    But do not program in COBOL if you can avoid it.

    --

    Less is more !
  14. Okay, enough pronoun bashing by rela · · Score: 5, Interesting
    This has been up, what, 15 minutes, and already all I can see is posts bashing his use of feminine pronouns. No comments on the text itself? It's got some good points that would apply to working on any kind of project, not just programming.

    I especially like:

    There is a lot of room for miscommunication about estimates, as people have a startling tendency to think wishfully that the sentence:

    "I estimate it might be possible if I really understand that problem that it is about 50% likely to be completed in 5 weeks if no one bothers us in that time."

    really means:

    "I promise to have it all done 5 weeks from now."

    Heh heh heh...

  15. The Pragmaic Programmer by Hirofyre · · Score: 5, Interesting

    Another good reference for this type of info is The Pragmatic Programmer. It lays out how to write flexible, dynamic, and adaptable code, as well avoiding traps that a lot of new programmers fall into. It takes the time to explain the "why's" behind a lot of the engineering approaches advanced programmers take. It is definitely aimed at "junior" programmers, though. Usually when we get someone just out of collage, I point them to this book.

  16. performance and quality of code by KIngo · · Score: 4, Informative
    I thinks his comments on dealing with performance problems are especially helpful, even for experienced programmers. Most decent programmers know how to debug, but few programmers excel in tackling performance problems. I've found that profiling is a very fruitful activity even if there are no obvious performance problems, because it provides tremendous insight into the runtime behavior of your applications. Things are often very different from what you would guess intuitively.

    If you happen to work with Java, there are quite a few good commercial profilers around that are really easy to setup and use (such as JProfiler or Optimizeit). Try working with one of these for some time and observe how your way of programming changes for the better. Most importantly, you learn not to pre-emptively "improve" performance - one of the deadliest sins of programming which is responsible for a lot of bad and unreadable code.

  17. How to *really* become a programmer... by T-Kir · · Score: 4, Insightful

    ...Is to use this site as your programming bible :-P

    It is a *must* read for any budding or experienced programmer! (You might split your sides from laughing too much).

    --
    Are you local? There's nothing for you here!
  18. The journey of a thousand miles... by EvilTwinSkippy · · Score: 4, Insightful
    The journey of a thousand miles begins with a step.

    I agree with the poster above, but I would like to add a twist. I have found that few successful programs are successful at simply programming. To be truely successful, you must be good at learning to program.

    It doesn't matter how much you can do or have done. The market for programmers will always be in untested areas doing the impossible, or at least the highly improbable.

    In the end, your actual training and experience is bunk, unless it used as the basis for learning more. The truely gifted programmer does not build static project. He or she builds a tome of routines and knowledge that are the foundations for code used decades later.

    Meditate on this, Grasshopper

    --
    "Learning is not compulsory... neither is survival."
    --Dr.W.Edwards Deming
  19. Isn't it ironic, don't you think? by ggruschow · · Score: 5, Insightful

    I like this quote from the document:

    "Life is too short to write crap nobody will read. If you write crap, nobody will read it."

    As I read through the comments here, it's apparent that virtually none of the posters clicked on the link much less read the document, and a good 90% of them didn't even read past the posting title.

    Anyway, the article touches on good points, but it's very clear where the author has personal experience with something and where he doesn't. Some of those times he starts to sound like the books he recommends (all excellent recommendations). Other times (e.g. 4.1. How To Stay Motivated), he simply states something that would be good, but doesn't describe how it should be done.

    He recommends "Succinctness is Power" by Paul Graham. Given the document's spottiness, he probably should've gone alnog those lines instead. Written down a little ditty about why you should read the material, and then his list of books and articles to read on how to be a programmer.

    If half of the programmers I've known had read his recommended list, I'd have a hell of a lot more trouble staying far enough ahead to have time to review articles and post on slashdot.

  20. Optimise for Source Code Legibility by DG · · Score: 5, Insightful

    I've been coding in an enterprise environment for quite some time now, and I have one rule that is cast in gold:

    Always optimise source code for legibility above all else. Never trade legibility for performance unless you have no other choice, and then document your cleverness in the code so that those who follow behind you can keep up.

    Here's why:

    When you first write a system, it will spend its first few months of life in a very intensive quality control feedback loop. Bugs are found and very quickly exterminated. The code is still fresh in your mind and you're "in the zone".

    But as the system stabilises, there is less and less reason to go back to the code, so that freshness wears off. After a little while, other priorities will take over and the internal model of the code will fade away.

    But there's still bugs in there - there always is. But any bug that makes it past the first few months is non-obvious, intermittant, rare, and so on (thus, harder to find)

    When one finally surfaces, _somebody_ is going to have to fix it. Sometimes it will be you, and you will appreciate code legibilty when you have to dust off source that has laid untouched for years. Not only does it increase the probability that you'll be able to actually find the bug, it cuts down on the time needed to fix it.

    There's nothing like being the guy who finds and fixes bugs within seconds of them being pointed out to enhance your reputation.

    But more often than not, it will be some other poor sap who gets saddled with your code and a deadline to get it fixed - and the guy who draws the short straw is normally not the biggest brain in the shop. There is no gratitude like the gratitude from someone forced to dive into somebody else's code, and who subsequently discovers that you have gone out of your way to make it easier for them to understand.

    This is _also_ a reputation enhancer. "That code was so well written that not only did it take no time at all to track down the bug, but I also learned a couple of new techniques in the process!"

    The true guru is a TEACHER.

    Oh, and ALWAYS check the return code from every system call and provide appropriate error trapping. That's good too.

    DG

    --
    Want to learn about race cars? Read my Book
  21. One big thing... by dasmegabyte · · Score: 4, Insightful

    Be prepared to be wrong.

    Be prepared to be proven stupid, to go in the wrong direction and have to forget it, to bust your ass for weeks only to discover you're doing it the dumb way.

    Be prepared to take criticism at this point, to learn the right way and actually practice it, to laugh at yourself and to not gloat over your fellows when they make the same mistakes. After all, the next time you do something dumb, they're the onces who will be pointing it out.

    These are skills that will get you by in any field, but in programming they'll save your ass.

    --
    Hey freaks: now you're ju
    1. Re:One big thing... by betis70 · · Score: 5, Insightful

      One thing I have learned is to not invest a lot of prideful ownership in a particular design decision I make. When reviewed by the team, it invariably gets modified somewhat, sometimes outright rejected. Taking ownership of a subproject (in my case) is one thing, but you have to be malleable enough to "give them what they want". Otherwise you end up beating your head against a wall.

      Oh and lose any aversion to eat crow is also a good idea. At some point you will pronounce "There is no way I made that mistake" only to see your log-in in the RCS/CVS log.

      --
      I forget...are we at war with Eurasia or East Asia?
    2. Re:One big thing... by droleary · · Score: 4, Funny

      Be prepared to be wrong.

      Ah, now you've gone and reminded me of my favorite interview moment. The manager sat smugly behind the desk and asked me the age old "What do you consider your greatest strength?" to which I promptly replied "I like to be wrong."

      The look of horror on his face spoke volumes, both of what he no doubt thought of me, and of exactly why that wasn't the kind of company I'd want to work for. I couldn't get out the door fast enough, and he couldn't wait to see me go. So I highly suggest doing the "brimming over with wrongability" thing right off the bat. :-)

  22. Engineers & engineers by Knacklappen · · Score: 4, Interesting

    4 years ago, I (Mechanical Engineer, major in Design Engineering) was involved in a bigger software project: Building a modular simulation system for vehicles, based on a database and a Multi-body code with output to Excel and lots of fancy stuff in between to make it all work. Since the customers and users were the people from our Design Dept, i.e. Engineers, I asumed that they would have thought through all the specs and that we basically just had to start.
    Big mistake! Being good and great Design Engineers in the mechanical and electrical domain, regarding software they were as clueless as any Marketing Drone. Whenever we tried to extract specifications, all we got was "make it work like that old APL code we have, but better and more modern and let is calculate/simulate more correct results". Aaaarrrrggggghhh...
    Unnecessarily to mention, that only very few actually knew how the old system worked and under what assumptions it was built.
    Well, we boxed our way through and today I am the only person in the company that has the total insight (the other 2 left). Unfortunately, we were never given time to properly document the system (of course the code itself is quite well documented but there is more to do than just that). In my naïvité I thought that the Design Dept with their fixation on drawings and Supplier Specs and Purchase Reservations and Engineering Change Notices should understand the value of proper documentation...
    A reflection I can now make: Hiring us Design Engineers to make the work instead of professional Software Engineers was probably the only way for the company to get the job done within reasonable time & budget. Non-existent specs, poorly understood assumptions for certain calculations - what a nightmare for any professional software developer!

    --


    Excellence: Moderate (mostly affected by comments on your karma)
  23. Anonymous Coward... by ackthpt · · Score: 4, Funny
    debugging can fix logic errors, but not design flaws.

    Such sagely wisdom

    With anonymity you write

    Knowing and unknown.

    --

    A feeling of having made the same mistake before: Deja Foobar
  24. Re:I''m sorry but a lot of this is common sense by avandesande · · Score: 4, Insightful

    Personal Skills are more important than most programmers think. With personal skills,a programmer is able to chat with marketing and managers to figure out what projects THEY should be put on, which helps build their skills and keep the job interesting. Personal skills gives the programmer the ability to influence managers to get the good projects. Personal skills will also promote a programmer in the eyes of of management, an equivelent programmer that doesn't communicate with management will be more quickly forgotten when raises are given out.
    Don't forget, the squeeky wheel gets the grease.

    --
    love is just extroverted narcissism
  25. How to be a Programmer and get laid by zootread · · Score: 5, Insightful

    you end up having very little contact with the softer gender

    I don't know where everyone gets this from. Maybe this was somewhat true 10-20 years ago, but not now. Not all programmers are socially inept dorks with no lives outside of computers. Or am I the exception to the rule? I tell women I'm a software developer and it *increases* my chances with them (I suppose they think $$$). Hey, and I've been a geek most of my life--and I still spend much of my free time on computers. Women like a guy who can fix a computer. Trust me. Being somewhat successful in your profession helps also, so reading "How to get a Programmer" will indirectly help you get chicks.

    If you're a geek, you *can* have luck with the ladies; especially if you've got a job and some cash to spend. Shave that beard, get a decent haircut. Buy some nice clothes. Go out, drink a coupla beers, and just talk to women. There are ladies out there for everyone. Trust me, they are just waiting for you.

    --
    Zoot!
    1. Re:How to be a Programmer and get laid by andrew_0812 · · Score: 5, Funny

      Stage 1 -- Denial. How sad. Hmm, it might be possible to write a program to converse with a female. That would be a fun date...

    2. Re:How to be a Programmer and get laid by zootread · · Score: 4, Funny

      Hmm, it might be possible to write a program to converse with a female.

      Yeah, its called instant messenger. Then if things get serious, you can move on to video-conferencing. ;)

      --
      Zoot!
    3. Re:How to be a Programmer and get laid by Anonym0us+Cow+Herd · · Score: 5, Funny

      If you're a geek, you *can* have luck with the ladies; especially if you've got a job and some cash to spend. Shave that beard, get a decent haircut. Buy some nice clothes. Go out, drink a coupla beers, and just talk to women.

      You forgot one: take a shower.


      I swear, if this gets modded as Insightful or Informative, I'm gonna worry...

      --
      The price of freedom is eternal litigation.
  26. I agree completely by Celandro · · Score: 4, Interesting

    The biggest clue that the writer has no clue about computer programming is his statement that 50 hour weeks are typical and 60 hour weeks are his limit. If you are writing code for more than about 2 hours a day, you are writing bad code that is horrible and buggy. I always try to explain what I do to people as very complicated math homework. Noone can actually do math homework for 60 hours a week. It is far too draining.

    The majority of most programmers days at work is spent processing ideas in the back of their heads while they do other things (like post on Slashdot). The 2 typical tasks in programming, adding a new small feature to an existing program and debugging a bug are about 100 lines of code and 2 lines of code respectively. These would take in theory half an hour and 2 minutes respectively. But as the old story goes, its knowing which $1 component to replace in the $1,000,000 machine that costs the $10,000. So it is in programming.

    Knowing how to integrate the new features and bug fixes without horribly ruining the existing design is the mark of a good programmer. Actually coding the fix or feature once it has been designed (on paper or in your head) is trivial. Overworking yourself leads to bad design and more bugs, which take even more of your overworked self to fix. This escalating behavior leads to burnout as well as the human brain can not spend that much time working on difficult problems every single day.

    Anyhow, now that my brain has figured out how it wants to implement the new feature Im working on, while writing this comment, its back to work to toss out my 100 lines of well designed code. If my writing seems confusing or poorly structured, its because my brain was working on code design, not paragragh design.

  27. Re:People are born programmers by fishdan · · Score: 4, Insightful
    If you're one of those "blessed few" who doesn't have anything to learn from books, you're part of the problem too. Let me tell you, if you've never looked at a book, there's alot of code you've written that isn't gonna scale, and every "real" programmer hates the fact that you are wasting your intelligence by reinventing the wheel 9 times out of 10. Sad sad sad. You might be pretty damn smart, but it's always smarter still to read. I remember this guy who spent 2 weeks trying to come up with a GREAT random number aloorithm, because some giant DB company that shall remain nameless had a random number algorithm that sucked in early JDBC. HE came up with a pretty slick method, clever, etc. But he had a copy of Knuth on his desk! Inside of which is one of the BEST random algorithms you'll ever see! But instead, he *had* to write his own.

    And because he had never read -- because of the extra 2 weeks he took writing that function -- the whole dot com industry collapsed.

    --
    Nothing great was ever achieved without enthusiasm
  28. Feedback by Ninja+Programmer · · Score: 4, Interesting

    Here's some feedback.

    Re: Divide and Conquer debugging approach ...

    Knowing *where* to split requires less skill than he suggests. While binary-splitting is useful from an algorithmic point of view, in the arena of debugging, there is no reason to be binary. I will typically split the problem many times (8 or more) at each step. This observes the fact that usually the cost of splitting the code is much less than re-running the scenario to test to see which split it makes it past, or fails to run properly.

    Neglecting examples in the debugging section is bad. In particular miss-synchronization of multi-threaded applications is an example that should be shown.

    Re: 2.6 How to Optimize Loops

    Ok, this is a really short list, and it misses the important principle of "caching", and some of the suggestions are wrong, or typically inconsequential.

    1. Sometimes floating point can actually be faster than integer code. This is especially true if the code can be completely pipelined. In particular trying to change from floating point to fixed point algorithms in modern CPUs may actually *decrease* performance. The details of this requires a lot more discussion.

    2. Inlining will be ineffective if the function routine is too large, or if the procedure prologue/epilogue cost is either low or unremovable.

    3. Fold constants together -- you should be more explicit about what you mean here. Certainly sub-expression elimination is a common technique that usually works well (but compilers are pretty good at finding that for you) but in some CPUs like the x86, immediate absolute value operands are practically cost-free. Perhaps he means "hoist" whenever possible? That certain does help.

    4. As to moving I/O into a buffer ... there is even more you can do. Move I/O handling to a seperate thread (more on this in my next comment.)

    5. Try not to divide and avoiding expensive casts requires much more detail. The best thing to say here is the understanding these costs requires understanding the underlying machine code that results from these operations. (Floating point division can actually be relatively cheap in the right context, and differentiating between cheap and expensive casts can sometimes be difficult, and require context as well.)

    6. Using pointers rather than indicies -- x86's have sophisticated addressing modes wherein there is commonly no difference between these two alternatives.

    Re: 2.7 How to Deal with I/O Expense

    An important principle to apply is to realize the parallelism via multithreading can substantially assist these problems. For example if some IO is non-negotiable, or non-predictable, then at least it can be blocked, or streamed in a seperate thread. The reasoning behind this is that modern operating systems can yield (i.e., block) program control (i.e., your execution resources) from a slow to respond thread to the faster ones. So you can overlap all your algorithmic work with the delays while waiting for the data.

    Re: 2.8 How to Manage Memory

    Something should be said about caching versus non-caching. First of all, point out the cached memory can be tens to hundreds of times faster than main memory (in modern CPUs.) Variables on your local stack, and globals that are commonly used in your inner loops, will tend to be cached. However array streaming will tend to de-cache your data.

    Running through your streamed data in multiple passes is especially bad, as it will require reading your data into the cache multiple times.

    Again much more can be said here.

    Re: 2.9 How to Deal with Intermitten Bugs

    This is an important topic. Its because it represents the hardest debugging problem. We all run into it sooner or later. Even if it is a hard subject to tackle, it has to be expanded on. Giving examples here are invaluable. You have to show that as hard as it is, it is possible to ferret out such bugs.

    Re: 2.10 How to Learn Design Skills.

    The biggest thing to explain here, I think, is to just explain that all code can and should have seperate documentation corresponding to it, that is written *before* the actual code is written.

    Re: 3.6 How to Work with Poor Code.

    Remember that people may be more open, or willing to learn than you think. If you decide you have to recode something for someone, it may be beneficial to be explicit about this and show them the results. But for such a thing to be effective, and to get over any potential ego problems, you have to make sure the rewrite is absolutely, clearly, obviously better (it should be shorter and more easily readable.) Your goal should be to make sure the programmer that is the target of the rewrite, considers the results to be a better approach that is worth emulating themselves. (Give a man a fish ...)

    Section 3.7 needs to be tied to the last paragraph of section 2.1. Scribbling over some "pristene" (sp?) code is irrelevant if you can easily recover it (which you can with good source control.)

    Re: 3.8 Unit testing -- my experience with this is a bit depressing. Unit tests always start out being a good thing, but over time, they are an extreme PITA to maintain. Unit testing is a good thing for what I consider *totally generic modules*. The reason being that truly generic modules do not evolve over time, while other code invariably does.

    Unit testing can only be effective if there in an enforced automated testing mechanism. I.e., a failure causes an automatic and non-negotiable rejection of code checked into the tree. I have found it remarkably difficult to convince people that such a policy is worthwhile. (SGI used to use such a mechanism, and, of course, it worked wonderfully for them.)

    Section 3.9 and 2.4 Belong together. How is 3.9 a team skill?

    Re: 5.2 How to Manage Third Party Software Risks

    In my experience, this is trivial -- rely on track record. Its more indicative than anything else. If the software has already shipped and has a history, then there is no problem. If it has not yet shipped (and you are hoping that it will in time for you to use it), then you are going to get version 1.0 software at best and more likely you are providing a beta test environment for the third party developer. Just put yourself in the shoes of the third party developer. In what way will they maximize the take away from their involvement in a relationship to sell you software? Remember business relationships can tend to dominate technical ones.

    Re: 5.4 How to Communicate the Right Amount

    In here you write: It costs its duration multiplied by the number of participants. Please underline and boldface this. It amazes me how managers don't understand this.

    Re: 6.1 How to Tradeoff Quality Against Development Time

    Remember that a good *design* will be resilient against poor code implementations. If good interfaces and abstractions exist throughout the code, then the eventual rewrites will be far more painless. If its hard to write clear code that is hard to fix, consider what it is wrong with the core design that is causing this.

    Re: 6.2 How to Manage Software System Dependence

    The harps back to a concept I referred to above as *totally generic modules*. These are just libraries that provide useful functionality and can take input without making any non-trivial assumptions, and contains no dependencies whatsoever.

    An example of this is the C run time library. A good example that will help make this clear is that the C run time library is able to provide a quicksort implementation without knowing anything about the underlying array it is sorting.

    State-less, assumption-free, zero-dependency code is very valuable. Its maintenance and development will be finite in cost, while its utility is on-going. Imagine the cost of rewriting the C library every time you use it.

    Impressing this upon programmers will help them recognize the value of reducing dependencies.

    Re: 7.2 How to Utilize Embedded Languages

    Ony option you seem to have avoided is the possibility of embedding pre-canned languages. The real problem with embedding a language is that useful language design is harder than you might think at first. People's aversion to using/learning it is bad enough, what happens when they uncover a flaw in your language that is fatal to its design? People who design real languages put a lot of work in them, that cannot be trivialized. Whipping up an embedded language is unlikely to yield the most stellar results.

    That said, there are currently numerous options for embedded other pre-canned languages. Python, Lua and Ruby come to mind. Before going off on some adventure of trying to design your own language, consider whether or not you are going to be able to do a better job than what you could do by embedding one of these languages. From my personal experience, I can tell you that Lua can be embedded in a few hours, and has probably the smallest learning curve of any language in existence.

  29. How to be a programmer... by kenthorvath · · Score: 4, Funny

    One day a Novice came to the Master.
    Master, he said, How is it that I may become a Writer of Programs?.
    The Master looked solemnly at the Novice.
    Have you in your possession a Compiler of Source Code? the Master asked.
    No, replied the Novice. The Master sent the Novice on a quest to the Store of Software.

    Many hours later the Novice returned.
    Master, he said, How is it that I may become a Writer of Programs?.
    The Master looked solemnly at the Novice.
    Have you in your possession a Compiler of Source Code? the Master asked.
    Yes, replied the Novice.
    The Master frowned at the Novice.
    You have a Compiler of Source. What now can prevent you from becoming a Writer of Programs?.
    The Novice fidgeted nervously and presented his Compiler of Source to the Master.
    How is this used? asked the Novice.
    Have you in your possession a Manual of Operation? the Master asked.
    No, replied the Novice.
    The Master instructed the Novice as to where he could find the Manual of Operation.

    Many days later the Novice returned.
    Master, he said, How is it that I may become a Writer of Programs?.
    The Master looked solemnly at the Novice.
    Have you in your possession a Compiler of Source Code? the Master asked.
    Yes, replied the Novice.
    Have you in your possession a Manual of Operation? the Master asked.
    Yes, replied the Novice.
    The Master frowned at the Novice.
    You have a Compiler of Source, and a Manual of Operation. What now can prevent you from becoming a Writer of Programs?.

    At this the Novice fidgeted nervously and presented his Manual of Operations to the Master.
    How is this used? asked the Novice.
    The Master closed his eyes, and heaved a great sigh.
    The Master sent the Novice on a quest to the School of Elementary.

    Many years later the Novice returned.
    Master, he said, How is it that I may become a Writer of Programs?.
    The Master looked solemnly at the Novice.
    Have you in your possession a Compiler of Source Code, a Manual of Operation and an Education of Elementary? the Master asked.
    Yes, replied the Novice.
    The Master frowned at the Novice.
    What then can prevent you from becoming a Writer of Programs?.

    The Novice fidgeted nervously. He looked around but could find nothing to present to the Master.
    The Master smiled at the Novice.
    I see what problem plagues you. said the Master.
    Oh great master, please tell me. asked the Novice.

    The Master turned the Novice toward the door, and with a supportive hand on his shoulder said, Go young Novice, and Read The Fucking Manual. And so the Novice became enlightened.