Imperative by day and functional by night

Natural Born Programmers

Smart people are not meant to be programmers.

The human brain is smart and efficient. It can analyse and solve many problems in an instant. Some of them simple and some of them difficult. Most of the simple problems it solves are hardly problems at all. Take the simple problem of distinguishing between odd and even numbers for example? How does the brain do that? Does it lookup its memory or does it process an algorithm to figure it out? To help answer the question, it’s best to think way back to the time when we were first introduced to odd and even numbers. We had no idea what they were back then and our brains had to learn them from scratch. We were told that the numbers one, three, five, and so on are odd, and that the numbers two, four, six, and so on are even. We were taught the fundamental rule for odd and even numbers. All numbers that are divisible by two are even numbers and all numbers that are not are odd numbers. To apply the rule to any number, we simply have to divide the number by two and check the remainder. If there is no remainder then it is an an even number, otherwise it is an odd number. This mathematical approach of applying the rule is easy for small numbers but a little harder for large numbers. Smart people who know this find alternative and efficient approaches. Once such approach involves considering only the last digit of the given number. If it is even then the entire number is even and if it is odd the entire number is odd. In this way the given number is reduced to single digit. Remembering ten single digits and knowing which ones are odd and which ones are even is easy to do, involves no math at all, and is extremely efficient for the smart mind.

Consider the following Java code fragment (a), based on smart human logic

// know what is even and what is odd
// (humans store this in memory)
Boolean even = Boolean.TRUE;
Boolean odd  = Boolean.FALSE;

// initialise results for numbers 0..9
// (humans store this in memory)
Map results = new HashMap();
results.put(new Integer(0), even);
results.put(new Integer(1), odd);
results.put(new Integer(2), even);
results.put(new Integer(3), odd);
results.put(new Integer(4), even);
results.put(new Integer(5), odd);
results.put(new Integer(6), even);
results.put(new Integer(7), odd);
results.put(new Integer(8), even);
results.put(new Integer(9), odd);

// get the last digit of the given number
// (humans look at the last digit)
int lastDigit = Math.abs(givenNumber % 10);

// lookup the result
// (humans recall the result from memory)
Boolean isEven =
        results.get(new Integer(lastDigit));

Now consider the following Java code fragment (b), based on simple math logic

// perform divide by two test and get result
boolean isEven = givenNumber % 2 == 0;

Both of the above code fragments produce the same result but the code in (a) is totally redundant in (b) and the code in (b) is much more efficient than (a). This reinforces the KISS principle and proves that straight out simple code is better than overly smart complex code. Programmers often go to extraordinary lengths to write complex programs to do simple tasks. They do this because they apply smart logic to the code that they write. What is smart and efficient for a human can be redundant and wasteful for a machine. A good program has no redundant logic and is both simple and efficient. It takes good skill to write a good program. Gifted programmers are naturally born with it. Smart programmers have to continuously develop it! This is not to say that smart programmers are not good programmers. They just have to work a lot harder to be any good at it.

What do you think?

  • Do natural born programmers exist?
  • Are smart programmers the best programmers?
  • Do good programmers have simple minds?

Written by warpedjavaguy

June 20, 2007 at 10:26 pm

Posted in java, programming

51 Responses

Subscribe to comments with RSS.

  1. Experienced programmers can understand the reasoning behind using a binary approach. But is it really better? The generated bytecode for a method using x % 2 == 0 is:

    0 iload_0
    1 iconst_2
    2 irem
    3 ifne 10
    6 iconst_1
    7 goto 11
    10 iconst_0
    11 ireturn

    The generated bytecode for a method using (x & 1) == 0 is:

    0 iload_0
    1 iconst_1
    2 iand
    3 ifne 10
    6 iconst_1
    7 goto 11
    10 iconst_0
    11 ireturn

    Both approaches result in the same number of bytecode instructions and take the same time to execute. This can be physically proven with a simple test program like this:

    public class Test {
       private static boolean isEvenBin(int number) {
           return (number & 1) == 0;
       private static boolean isEvenMath(int number) {
           return number % 2 == 0;
       private static void testBin() {
           long start = System.currentTimeMillis();
           for(int i = 0; i < Integer.MAX_VALUE; i++) {
           long end = System.currentTimeMillis();
               "time isEvenBin (ms) = " + (end – start));
       private static void testMath() {
           long start = System.currentTimeMillis();
           for(int i = 0; i < Integer.MAX_VALUE; i++) {
           long end = System.currentTimeMillis();
               "time isEvenMath (ms) = " + (end – start));
       public static void main(String[] args) {

    Here are some sample results from the test:

    >java Test.class
    time isEvenBin (ms) = 1860
    time isEvenMath (ms) = 1906
    >java Test.class
    time isEvenBin (ms) = 1890
    time isEvenMath (ms) = 1860
    >java Test.class
    time isEvenBin (ms) = 1859
    time isEvenMath (ms) = 1875
    >java Test.class
    time isEvenBin (ms) = 1875
    time isEvenMath (ms) = 1875

    WarpedJavaGuy – July 3, 2007

    FYI – This response triggered this discussion on programming.reddit.com


    June 21, 2007 at 12:38 am

  2. To check if a number is even or odd, just use bitwise AND to check the last bit. After all, the last bit is what signifies even/odd.

    boolean isEven(int x) {
    return (x & 1) == 0;

    I guess this means I’m a better programmer? 😉

    Matt Turner

    June 20, 2007 at 8:33 pm

  3. I just stumbled across this entry, so here’s my two cents worth.

    Smart, good, gifted, natural – you’ve used all these descriptors, but no one’s answered the questions posed, which were all intriquing.

    Based solely on personal observation, here’s what I think:

    1) Yes, I think there are natural born programmers. At least, I would support the theory that there are folks that are just naturally good at programming. At the risk of reading too much into the way the question was worded, I think one could debate natural “born” vs. natural “ability”. Are we born programmers, or are we born with inherent skills that are perfect for the art of programming? Either way, I do think there are people that are just naturally good at programming.

    2) I do not think smart programmers are NECESSARILY the “best” programmers (whatever best may actually mean). While there does seem to be a pretty strong link between programming ability and intelligence, I know from past experience there are some pretty smart people that are crappy programmers, and some pretty great programmers who weren’t very smart.

    3) No here’s the question where I just get lost in the details. Is a “good” programmer meant to be a “natural” programmer? If not, is a good programmer then someone who is not quite a natural, but better than average? Plus I kind of get confused as to why the question is even asked. Many times when questions are asked in a series they build to reveal a hypothesis, or at least have an implicit cohesion. I’m having trouble seeing how this question “follows” the preceeding two. In any event – I do not believe a “good” programmer has a simple mind, but many times good programming is simple.

    Hey, you made me think. Thanks.

    WarpedJavaGuy – June 23, 2007

    Regarding 3).. I am referring to a simple mind in this context as one that is highly logical and literal, as opposed to one that is highly creative and lateral. Is a good programmer one that has this type of mind? And if so, was it meant to be?


    June 21, 2007 at 4:47 pm

  4. Gifted programmers don’t program in java


    June 21, 2007 at 1:23 pm

  5. And gifted programmers like Java autoboxing


    June 21, 2007 at 1:28 pm

  6. for me a gifted programmers is gifted with great logical thinking and of course gifted with maths. I just realise i like the logic and hates the maths. but familiarise myself with it and somehow they hired me as a programmer.

    programmer is a technician..! harsh, hard, but that’s how i feel it.


    June 21, 2007 at 1:54 pm

  7. From my experience great programmers need just two traits intelligence and laziness.


    June 21, 2007 at 2:04 pm

  8. Natural programmers do well on IQ tests. And every other test of intelligence.

    The “smart” programmers that have to “continuously develop it” would probably only do well on a web IQ test.


    June 21, 2007 at 2:08 pm

  9. An irem bytecode should generate machine code slower than a iadd bytecode. Why? A DIV opcode ( used to generate remainder ) takes longer than a bitwise AND opcode.

    DIV – http://pdos.csail.mit.edu/6.828/2006/readings/i386/DIV.htm
    AND – http://pdos.csail.mit.edu/6.828/2006/readings/i386/AND.htm

    Perhaps the java virtual machine retards the execution of the AND such that it appears to execute at the same rate as a DIV. Perhaps there is just a great amount of overhead in moving from bytecode to machine language.

    Whatever the cause of slowness for java, it is not inherent to the operations being performed. Only the implementation in this language.

    Michael Speer

    June 21, 2007 at 2:18 pm

  10. The example in the post is too extreme. I don’t think anybody would ever do it via the first method. The ‘wrong’ way to do it example should have something that people actually do.
    Anyways, pipedings reminds me of this guy I used to work with who wrote completely iterative code in Java (no objects), didn’t test it, didn’t bother with comments but to his credit, he got stuff done. The only problem was the only he could understand what he was doing.

    WarpedJavaGuy – June 22, 2007

    I purposely exaggerated the example to make it more closely reflect the way our ‘minds’ do it. I also wanted to demonstrate a most extreme case.


    June 22, 2007 at 1:01 am

  11. I consider myself a good programmer and have seen lots of supposedly smart people fail at programming. In my opinion, the good programmer
    and by amassing experience gets better and better at


    June 21, 2007 at 5:15 pm

  12. You can be really good at getting stuff done but terrible at getting stuff right. Also when you consider “Done” is an imaginary term in programming getting stuff done reduces to pushing code out quickly. So then you have the programmer who pushes code out quickly. Does that make him/her good? What matters more in a software shop, the time between releases or the quality of individual releases? Without showing too much bias let me state that you could get stuff done quick and get stuff done right barring you use the proper tools and design philosophies.


    June 21, 2007 at 6:34 pm

  13. I felt all the questions at the end of the post were a bit weird. There are clearly going to be people who are born with a natural quirk or affinity for the discipline and insight of programming. One thing I have often noticed is that multilingual people tend to be good at picking up the syntax and conventions of a new or unfamiliar programming language. The correlation is strong and logical in my experience.

    However I would regard computer programming as being an extremely unnatural task and one that you wouldn’t expect people to be good at “naturally”. Like double-entry book keeping. There’s a significant amount of skill and knowledge to doing a good job quickly. Having, say, a profound understanding of logic or pure maths might help to understand the task at hand but expressing in the unnatural syntax of things like x & 1 or x % 2 is clearly more a matter of more or less rote learning.

    If you rote learn the idiom and the syntax then you can begin to program but to get beyond that then you will clearly need more than a capacity to learn and refine your skills.


    June 21, 2007 at 7:11 pm

  14. 1) Not sure. Nature vs. Nurture is still an open question. Last I heard it was about 50-50….

    2) I think ‘smart’ people have a much higher chance of being lumped in with the better group.

    3) I doubt it. Their minds are probably just better at distilling things down to their essence

    I think the best programmers exhibit curiosity & interest. You should always be asking: Is there a better way to do this? What happens if I do this(AKA constant refactoring)? How come you did it that way (fyi, very likely to piss off the mediocre programmer)? I’ve never heard of that, I’ll have to check it out!

    Oh, and a poor memory. If I can’t remember how or why I did something, I’m not quite as opposed to changing it (hopefully, for the better!). Nothing is worse than code/design inertia.

    Now, what was the question? 😉


    June 21, 2007 at 8:21 pm

  15. also, to rj ryan, while on a gate level AND is faster and modulus (you only have the one gate to go through as opposed to multiple) modern CPUs are tuned so that remainders can be computed in a single clock cycle. One clock cycle is greater than the propagation delay of multiple gates…

    WarpedJavaGuy – June 23, 2007
    Optimised machine logic 🙂 Makes it even harder for programmers to not take hardware for granted.


    June 22, 2007 at 9:23 am

  16. Good point!

    Prabha Govind

    June 22, 2007 at 7:13 am

  17. dude. .. iand is _much_ faster than irem….

    think about it conceptually..

    rj ryan

    June 22, 2007 at 7:31 am

  18. Not sure about the java bytecodes, but the absolute fastest way to check for odd / even is to rotate through the carry flag, and jump on carry. It requires three instuctions:
    1. clear carry
    2. rotate right with carry
    3. jump on carry


    June 22, 2007 at 8:59 am

  19. Note for above. The big savings is in not needing to send a constant to test against. You don’t even need to rotate (at least on x86) because arithmetic and logical shifts shift into the carry register, so it becomes two ops.
    1. Shift right
    2. Jump on carry
    Assuming your value is in AX
    SHR AX,1 (2 bytes)
    JC :NEAR (2 bytes)


    June 22, 2007 at 9:20 am

  20. To Post #8.

    Any optimize worth it’s salt knows to optimize the mod 2 case to not use a div.


    June 22, 2007 at 3:48 pm

  21. nice article…

    Rupesh Mandal

    June 22, 2007 at 5:57 pm

  22. I think that a lot of different skills translate to being “smart”. For instance if Bob can figure out how to build that deck using less lumber and time than Steve then Bob is a smarter deck builder. Bob translates problem solving ability into better decks.

    If it takes Bob 15 minutes to balance the checkbook and it only takes his wife Jane 5, then Jane is smarter than Bob. Jane translates problem solving ability into quick accurate calculations.

    Likewise a good programmer translates cognitive ability into code. He may be an awful public speaker, proposal writer, etc, but his medium of choice is code, and within that area he shines. So he’s a smart programmer, but a dumb salesman.

    Because of the way society is laid out though (not necessarily your company), the smart programmer will be perceived as smarter than the smart salesman (everything else being equal). We’ve decided that math ability is smarter than people ability for whatever reason.


    June 22, 2007 at 5:59 pm

  23. I am gifted at math and found at at 25 that I was gifted also in programming. I never write any code until I have thought about it a few times. I write throwaway code to test idea’s and to see if an algorithm is efficient before I waste time writing a huge program just to find out it is slow and efficient. Once I understand the “real” issues, the natural solution emerges and it is usually an elementary task to code it up. I know the logic is correct before I start, so there are usually no suprises. Many programmers have accused me of being lazy because I don’t crank out lots of code right away and hack at it until I get something that works. I think THAT is a waste becuase you are hacking away trying to find something that kind-of works and once you demonstrate it to the boss, they always say “good-enough” and Ship it! Other programmers have criticized me because they think my code is too complex. It is their failure to realize that I have the ability to create flexible systems that “derive” logic on the fly, so you do not have to code up special cases, etc. It’s called parametric programming and I rarely see it anymore. look it up and it just may convince you to grow up and out of “practical” coding methods that ensure that you will have to spend lots of time maintining the straight forward approach.

    By the way, the solution to the even/odd issue I thought of before I even finished the first paragragh. I saw the same one liner in my head .

    // perform divide by two test and get result
    boolean isEven = givenNumber % 2 == 0;

    This is a parmetric approach as the parameter “givenNumber” works on any number and the mod operator “%” gives just the remainder. This also works in many other ways.

    To display only every hundreth line in a big dump, try this

    if( lineNumber % 100)
    printf( “Debug Statement line number = %d”, lineNumber);

    By making the “100” parametric also, you can dyncamically change the output interval by passing in a new value. Smart AND Efficient.

    Be a real genius and look up how hash functions are generated and then learn how to use them. Java HashMap rules…..but I still miss my old “C” math libraries which did the same thing…


    June 22, 2007 at 7:12 pm

  24. @steve – I think you are confusing speed with intelligence. I’m pretty sure my wife can balance a checkbook quicker than I can, but I seriously doubt she could derive the formulas for compound interest or amortization from scratch. Who’s smarter here?


    June 25, 2007 at 3:12 am

  25. @Geoff – Are you sure? That’s what every education system is based on, the simple axiom that if Timmy gets 100 right in an hour and Tommy gets 90 right in an hour, Timmy is smarter. We can’t quanitfy “smartness” in a way that satisifying to everyone so we take little shortcuts like that.

    My original point is that a natural-born/smart programmer thinks closer to code than deck building. But even with that advantage, smart programmers can thwart themselves or others. If I can write something that’s better optimized in one line of code, then I’m “smarter” than the original implementor who wrote it in 3 lines. Except that my code is impossible to read, unless you’re as “smart” as me. And that performance improvement…10 microseconds on a Tuesday. Hmm…and there’s a small intermittent bug that may be related to that code, but no one can understand it so they don’t know for sure. In the end, my smarter (apparently not) line of code is commented out by the next guy to come along who says, why didn’t he just write it in 3 lines like this?

    It’s the same with books. If you don’t understand einstein or nietzsche you’re not as smart as someone who claims to. So some smart guy comes along and writes cliff notes and then all the smart people bemoan how stupid people don’t really understand because they didn’t read the original…in German.

    Whoa..I’m way off topic. Question answers:
    1. Yes – these people think closer to code than deck building
    2. Only if the statement is reflexive
    3. Probably not, as simplifying something that’s inherently complex seems like a pretty difficult task. And for every person that thanks you, one will rise up to claim that you’re completely missed the point of the original.


    June 25, 2007 at 7:41 pm

  26. Wow! I really did get some good responses here. Thank you to all 🙂

    When I was writing this post I was thinking about how programmers go about coding solutions to real world problems that they already know how to solve. The examples in the post demonstrate a ‘smart human’ approach and a ‘simple math’ approach to solving the odd/even number problem. I am wondering whether or not there any people out there with minds that find it harder to process smart logic and easier to process math logic? Are there people out there who naturally find the mathematical approach to be the most efficient for any sized number without ever needing to derive any ‘smart’ alternatives? Without being limited to just mathematics, would a programmer with this type of mind be a natural? Would that make them a smarter and better programmer? And finally, if they really do find the smart logic approach too slow and difficult to process (or even comprehend), is it because they have a simpler mind?


    July 2, 2007 at 1:28 pm

  27. Hey Bozman,

    Thanks for the sardonic reminder to look up hash functions… Why don’t you look up hubris in the dictionary?


    July 18, 2007 at 4:42 am

  28. I believe natural born programmers exist (and I have met some), just like there are natural born basketball players, tennis players, etc. It’s in their blood, they are naturally good at it. But that doesn’t mean that they have to work less hard to excel…Obviously if they don’t work hard somebody with less talent (but who’s continually working on improving their skills) might come up with a better program/design/solution.

    Also, that they are “naturally good” doesn’t mean that their programs will be maintainable solutions in the future…

    I believe that (at least for typical enterprise applications), code that has “meaning” is far better than code that is “perfect”, if you know what I mean. More often than not it doesn’t matter that the code is wasteful for a machine. What matters is the quality of the abstractions.

    Manuel Palacio

    July 18, 2007 at 9:54 pm

  29. I’ve seen some brilliant programs too that execute perfectly but have code that only their author’s can maintain. Whether or not we consider them ingenious is questionable. Is the code extremely simple and intensely logical or is it extremely complex and intensely methodical?


    July 20, 2007 at 2:07 am

  30. A good programmer for me is someone who can read other code and logic regardless of what programming language it is.
    Someone who can write, modify and debug bunch of code and logic without messing it up.


    July 23, 2007 at 1:12 am

  31. A good programmer for me is one who is humble enough to know that this question is impossible to really answer but at the same time knows that continuing to improve in the art of programming is a way of life that one can choose or not.

    The thing I have seen is that all who get emersed in this kind of rhetoric are more likely to be unhappy with their environment, i.e. the daily mire of having to deal with code you don’t like particularly.

    Well that’s tough I know (after twenty seven years of doing it) but what can one really do? I would rather choose to point the way to the beacons of real solutions rather than engage in comparing one human soul to the next which is ultimately wrong.

    I don’t mean to be too heavy about this; discussion is a good thing and there are many points of view of course, many here I have enjoyed reading.

    Cheers to all.


    August 7, 2007 at 8:07 pm

  32. Hi,

    My thoughts are that great programmers can be both literal and succinct as well as lateral and creative. It all depends on the purpose of the code. If you need to innovate, then you might need a lateral and creative programmer. If you need to gain raw performance or to punch out loads of repetitive code, then you might need the literal, straight-forward guy.

    It’s like any other form of creative process. You begin with the creative, outside-the-box types and then you pass on their ideas to the people that can make it happen in an efficient and methodical manner. Both have their uses and neither is usually suited to replace the other.


    August 8, 2007 at 2:02 pm

  33. While not necessarily sticking to the original question, the article provided here, should provoke some food for thought and perhaps start the next chain of discussion?.

    The study provided an analysis of confidence and competence and particularly how those blessed with confidence didn’t actually have the competence (or at least the metacognitive ability to accurately assess their true level of competence). While the subjects of the study were not programmers, be careful in dismissing the results as “Oh I’m smarter than that”. That could be the first clue its time to jump into the room full of mirrors and have a good hard look at yourself.


    August 16, 2007 at 4:19 pm

  34. That is a great article there Trev 🙂

    I particularly like the concluding sentence:
    >> Let us assure our readers that to the extent this article is imperfect, it is not a sin we have committed knowingly. <<

    In programming terms it could read:
    > Let us assure our programmers that to the extent our code is imperfect, it is not a sin we have committed knowingly.

    Similarly, the last sentence in the introductory paragraph could read:
    > The same knowledge that underlies the ability to produce correct code is also the knowledge that underlies the ability to recognize it.

    I wonder if gifted programmers are skilled and unaware of it?


    August 17, 2007 at 10:59 am

  35. I think there are probably a lot of gifted programmers who are skilled but because of this they are aware of their limitations, accept there are many ways to solve a problem and constantly look for ways to correct and improve their performance. Similarly there are many programmers who believe that they are gifted and that only they know the “right way” to do something but in fact fail to properly assess their real capability. The conversation chain above is probably a good example of this 🙂


    August 17, 2007 at 4:05 pm

  36. To Post #18

    as soon as you rotate right, you change the value in the register AX. under certain circumstances, you need to preserve the rotated value which is not necessary when you provide a constant to test against. still, rotating to the carry is a neat way to test odd/even.

    Charlie Chan

    August 31, 2007 at 6:45 pm

  37. Great programmers design and build simple yet elegant solutions to complex problems. Average programmers build complex, clunky solutions to simple problems. Like in any field of endeavour, the greats make it look easy.


    September 5, 2007 at 12:11 pm

  38. Smart programmers realise the difference between fuzzy logic and real logic.

    In the above example, only a novice would produce code that emulates human thought instead of considering the most efficient approach


    September 12, 2007 at 1:17 pm

  39. I did exaggerate the first example for the sake of my argument. But I’ve seen code written by experienced and novice programmers alike emulating human thought literally. For example, consider the line of code in the first example that retrieves the last digit of the given number like this:

    int lastDigit = Math.abs(givenNumber % 10);

    I’ve seen code that first converts the given number to a string, strips off the preceeding characters, and then converts the remaining character back to a number again. I’ve also seen code that loops through each digit and returns the last one. I too would expect that only a novice would do that :-S


    September 12, 2007 at 1:57 pm

  40. First of all it is not smart doing something without getting to know your tools (think computer). Then smart people tend to like simple solutions. The first solution is anything but simple. It involves a lot of work. If you’re smart you can even generalize the algorithm without knowing too much like this. I use a decimal number system and I check the last digit if it’s even. Computers use a binary number system under the hood (everybody know this knowadays!) so I’ll check for the last binary digit. Which gives the solution of ANDing the number with 1.

    Smart people do know if they don’t know enough and then they look for more information. Dumb people just do it their way because they think that they’re smart enough.

    Well, unfortunately this isn’t always true 🙂 There are a few smart guys, I knew two of them. who prefer doing over thinking too much. The “let’s make it work somehow, we’re already late” type. One of them was a mathematician consultant (crypto field) he didn’t know sh*t about programming.

    Laszlo Marai

    September 27, 2007 at 9:38 pm

  41. A natural programmer already knew the answer to the problem before they got to the code example. The good programmer obsessed about the java byte code. A natural programmer is scale free. They can zoom in and out of a system architecture when needed, get the bigger picture, or get down and dirty with the bytes. Talk to a natural programmer about a proposed system, and they will have a solution to mind as you are talking. That’s the difference.


    October 10, 2007 at 5:36 am

  42. Nonsense! Natural programmers already know the answer because they’ve experienced the question(s) before. Experience!
    Sound familiar.
    Some people are faster learners than others. Also people’s thought processes vary from person to person.
    A natural programmer might be a person gifted in certain thought processing, giving them a specific advantage. However that doesn’t mean that the way they think is the be all end all. Otherwise why don’t we find the answers to so many other programming and non-programming issues in life.


    November 12, 2007 at 11:40 am

  43. Programming is a skill, some gain it naturally some with some effort some with lots of effort and some never! Smart, good and better all sounds relative, once smart, good or even a known as a brilliant programmer can be the worst in a different situation depending on what they do, the team they work with and the tools and the complexity of the domain and so on.

    Btw I don’t know whether I am naturally gifted or smart or even good at what I am doing but I enjoy what I am doing and other finds it appealing time to time. This seems like a series of questions which needs some boundaries to find some sensible answers.

    Just my 2cents! Good day all.


    December 5, 2007 at 11:19 am

  44. I would like to see a continuation of the topic


    December 20, 2007 at 9:03 pm

  45. OK, stay tuned for a follow up post early in the new year!

    WarpedJavaGuy – January 18, 2008

    As promised, here is my follow up post where I delve even deeper into the odd and even number problem and discover a pattern that is common to both humans and machines. A natural born programmer already knows that. I am not one of them. But I am pleased to have learned about them here 🙂


    December 20, 2007 at 9:30 pm

  46. I’ve been making my own homebrew snes game for a few months and now I totally understand why I’m throwing like a gazillion enimies on screen and it DOESN’T SLOWDOWN. And I’m looking through my codes and I’m thinking “Isn’t that the most obvious choice of coding?” or stuff like “How did those old programmers not see that?”


    February 18, 2008 at 8:47 am

  47. Not all programmers are smart. Many are just computer geeks who take programming course in college. And then they get hired just because of their certificates.

    It’s obvious that most smart kids woud rather become engineers, doctors, architects, scientists and such. Only a few love programming.

    So who are these programmers? Most of them are just computer geeks who get paid to program because no one else can. A good programmer can do more than just write code.


    September 11, 2008 at 7:32 pm

  48. I don’t think humans divide a number by 10 and then check whether the remainder is 1,2,3,4,5,6,7,8,9, or 0. I think humans look at the “string”, take the last “character” and compare that with the known odd or even digits.

    To be fair, the program should also start with a string. Then the idea of comparing the last character with “1”, “2”, “3”, … instead of converting the string to a number and doing % 2 makes a lot more sense.

    So in this case smart people and good programmers converge.


    October 15, 2008 at 10:10 pm

  49. I was thinking “Surely to god there is a pattern with Odd & Even numbers”. I have usually used the modulus operator to determine whether a number was even or odd, but the first bit is always set when a number is odd, and thus you can simply use the AND asm instruction, or use the & operator, which I imagine is more efficient(not by much I assume). At least when it comes to C\C++, there probably isn’t much of a difference when it goes through the optimizer, or you’re working with virtualized code.


    December 18, 2009 at 3:32 pm

  50. The problem is that you are trying to compare something that is a result of numerous factors… thus “odd” with a preset dualistic programmers thinking dividing all those abilities to even. Are you so egocentric to believe that you have the sufficient knowledge to emulate how the brain functions?!

    (you don’t have to answer… you are just a programmer, a person who adapts to given circumstances more than has the ability to shape the circumstances for himself)


    December 27, 2009 at 3:56 am

  51. A smart programmer would know the difference between the terms dividing by 2 and modulo 2.


    February 5, 2011 at 10:40 am

Comments are closed.

%d bloggers like this: