Tech Trained Monkey

Everyday Problem Solvers

Category Archives: Intelligence

Analysing success

As the 1940’s air war in Europe intensified, the Allies faced a major problem. Their bombers would leave England by the hundreds, but too many of them didn’t return, brought down by extremely heavy enemy flak. The Allies desperately needed to beef up the armor on their planes to provide protection, but armoring an entire plane, or even an entire cockpit, involved far too much weight. How could they choose the few especially vulnerable places to be armored?

A couple of clever engineers solved this problem with a counter-intuitive analysis. After comprehensively logging the locations of flak damage inflicted around the fuselages, engines, and cockpits of planes returning from hundreds of bombing runs, they calculated Read more of this post

Why english

As you know (or not) I’m Brazilian. I was born in Brazil, studied in Brazil, I work in Brazil, and (I’m ashamed to say) never been to a English speaking country. Nevertheless my blog is written in English and more often than not I hear the question “Why English? Why not Portuguese?” and I my answer always is “Because I want to reach as many people as possible”. Reaching people is not why I write this blog (my motives are strictly selfish) but it’s the motive why I do it in English.

I also program in English. When people ask me why I reply: Read more of this post

I’ve inherited 200K lines of spaghetti code—what now?

kmote asks: I am newly employed as the sole “SW Engineer” in a fairly small shop of scientists who have spent the last 10-20 years cobbling together a vast code base. (It was written in a virtually obsolete language: G2—think Pascal with graphics). The program itself is a physical model of a complex chemical processing plant; the team that wrote it has incredibly deep domain knowledge but little or no formal training in programming fundamentals. They’ve recently learned some hard lessons about the consequences of nonexistent configuration management. Their maintenance efforts are also greatly hampered by the vast accumulation of undocumented “sludge” in the code itself. I will spare you the “politics” of the situation (there’s always politics!), but suffice it to say, there is not a consensus of opinion about what is needed for the path ahead.  Read more of this post

Creativity, Technology and Necessity

Last sunday I watched The Avengers (awesome movie by-the-way, Kudos to everyone involved) and yes The Hulk is awesome, Scarlett Johansson is hot and Thor does have a mighty hammer, yes, but my favorite character is not a human, it’s a software, and it’s know by “Jarvis”. In fact what I like most about Iron Man movies is not the plot, or characters or Robert Downey Jr. What I like most is the tech, specifically Jarvis.  Read more of this post

About commenting code

I will not lie: I always had a beef with literature and non technical text interpretation. Dont get me wrong: I’ve never misunderstood a math problem text, or a chemestry-phisycs one, but when the literature teacher would say that the poem was about the solitude and the seek of self I was always like “WTF?!? where did she took that from?!? this poem is about a man who enjoys long walks in the desert!!!”. Some say that I might be a little too literal and stuff, and I disagree! I’m practical, rational, precise, objective and I belive that if you want to tell the world about “solitude and seek of self” you should do it clearly and precisely, and not by writing a 200 foot long poem that tells the story about a man walking in a desert.

And yet no one expect to find something like this on poems:

Roses are red

Violets are blue

// Here I’ll define the meaning of life

I don’t live for myself

// And now a recursive definition of life

I live for you

I know, very Shakespeare-like… The point is: Why should a programmer write comments on his own code?!? If something was very hard to figure out and program, it should be very hard to understand and maintain! Right?!?

About “Who should learn programming”

As most of you already know, there’s a buzz about who should learn to program and who should not. I will say now that im in favor that everyone should, and I say this because as you learn to program you learn a set of techniques that will most definitely help you all of your life.

Most people who are discussing this matter are focusing on the question “Ok, I learned to program, now what do I do with it?”. My answer to this question is: “I don’t care!”. Read more of this post

Logging and software development maturity

According to Wikipedia maturity is:

a psychological term used to indicate how a person responds to the circumstances or environment in an appropriate manner. This response is generally learned rather than instinctive, and is not determined by one’s age.

It is a widely know and accepted fact that write logs is a very good thing, since it helps you find out what happened at a given moment of time. It is rule number one on the universal developer book, if it existed… But again and again I find a lot of programs that just don’t do it.

I’m used to clients calling and say that something is not correct with the product, but it makes me cry when I ask for the logs and he says that there are none and I want to kill the dev who didn’t write log. I always find the bastard. If by any chance it is not a intern, oh help me lord, some blood will be shed!

Logging came to me as a very instinctive thing. My firsts programs didn’t write any log, but of course, I was the only one using them. But as I got better and better i felt the need to better control my “world”. I was scared of the fact that a problem would occur and I wouldn’t be able to know about it. In order to really evolve and grow as developer one needs to make more complex and bigger programs and, more importantly, learn from ones own mistakes. Logging is perfect for the learning part, because you don’t need to bother the users with questions and other stuff (if you logged all the information you needed).

One might start to wonder what does it have to do with maturity. Just logging is not enough. Logging for the sake of it does not help. You need to have a consistent, useful, categorized and, most of all (I think), easy to track log message. It takes real-maturity to know how to log. You should log everything that happens but each event must be logged in a particular way. Logging user interactions that same way you log Null Reference Exceptions is not very helpful. Remember that logging provides information and information is gold!

A lot of people do write a bunch of logs. They actually log the entire thing. Take World of Warcraft for example: Everything you do in the entire game can be traced! They can trace every little critter that you killed. They know which weapon you used. They log everything! But, as i said before, just write messages is not enough. You have to write them in a understandable, easy-to-track way. If a developer in your team can’t trace back, for example, the users actions, such as buttons clicked, radio button choices, in-screen info, check-boxes selected, etc, your log is not good. It might help you find and solve a problem, but it could do a lot better. I recently learned a important lesson.

I must say that I have never had a problem with production environment software (Yes, my programs bugs, but always very soon after deploy, so I was always very close by to help). Thank god all programs that I wrote never gave me serious headaches. Until a couple weeks back. Deploy went fine and everything was peachy. So one beautiful morning the client called me and reported a issue. As always I asked for the logs, he sent me and then the my world felt apart. I could not trace what was going on. Everything was there, but i could not set a time-line to the events. Due to multiple front-ends and multiple web services servers it was very, VERY hard to track what happened to a user. I had a special hard time figuring out what messages on the web services logs belonged to whom. It was a nightmare. I wanted to cry. But I managed to do it and I matured a bit… no, I matured a byte… sorry for the pun…

So now I’m developing a new logging lib and a log-reader tool (feel free to “borrow”) that is planned to solve the multi user/thread/server scenarios. The current log lib we use today is perfect to developer and single-user/thread/server scenarios. You can easily “follow” up what and when it happened, what came after what and so on. But when multi-thread/multi-users/async-operations come-out to play things get ugly. Since the current lib only logs the time and severity of the event its very hard to track continuous actions of a user, or even the path of a particular thread.

The lib itself is not enough though. The real magic is the log reader. The reader creates a visual path of the massages. It literally creates a “fork” for multithread visually showing parallel operations and stuff! Its getting very cool when its ready ill post the source code… but now back to maturity…

I must disclose that I’m not the most seasoned developer out there… for christ sake I’m only 24, but this much I can say: Write easy to read and understand log messages. Your kids will be thankful! Ok maybe not, but you will when you need to know whats really going on!

Is the ability to use a search engine more valuable than memory itself?

Einstein still amazes me… Quite some time ago (i could not get a precise date) he said

Never memorize something that you can look up. – Einstein

and it got me thinking: Although memory increases our productivity (asking google everything is very time-consuming), is it really necessary? I know that this is a highly radical idea, but today you can easily “load” all the specific info you need to accomplish a task in a couple of minutes! How many times have you caught yourself checking google for semantics of a given programming language??? I find myself googling for LINQ semantics all the time…

There is no doubt that its extremely hard to go by a problem that has not yet been solved. Most of the already solved problems has a How To posted on a blog or something (ok, you may not find out a how to build a nuke…). The difficulty lies on finding the place where the How To is.

It’s a fact that some people know how to make better searchs in google than others. My mother for example usually query google the following: “How can I make a delicious dish using X and fresh tomatoes?”… I would query “X tomatoes recipes” instead… and probably get “better” answers. But the point here is: she doesn’t query “How can I tell that tomatoes are fresh?” or “How can I tell that the potatoes are ready?”… she memorized it already…

I know what you’re thinking. You’re thinking that a lot of times you can’t choose what to remember what to forget, and sometimes doesn’t matter how hard you try, you just cant remember a few simple things. I’m not arguing about that, I know that if you search something over and over again is very likely that at a point you will just memorize it and there’s nothing you can do about it. I just find very odd that some people are really focused on memorizing stuff. I know a couple of doctors that actually say that if you know where to look for information and know how to cross them, a 15 old teen can diagnose almost all deceases.

If information is available and easy to find why people try so hard to memorize them? Learn how to make it more accessible instead! Maybe its a cultural thing… my mother’s, and probably yours too, education was based on memorization! Subjects as history and geography can be really tricky… Few schools notice that understanding why something happened is more important that knowing when it did! To hell with schools, very few people get it! Its like math formulas: If you don’t know when and how to use them it doesn’t matter how many you know.

Google can sure help us remember formulas in a few seconds. But he does take a lot more time to teach us how to apply and use them… if he ever manage to do so…

Internet and Intelligence

Intelligence is a very controversial topic. There’s no official definition that is accepted worldwide, but among all the definitions, scholars usually adopt one of the two:

A very general mental capability that, among other things, involves the ability to reason, plan, solve problems, think abstractly, comprehend complex ideas, learn quickly and learn from experience. It is not merely book learning, a narrow academic skill, or test-taking smarts. Rather, it reflects a broader and deeper capability for comprehending our surroundings—”catching on,” “making sense” of things, or “figuring out” what to do.Mainstream Science on Intelligence

or

Individuals differ from one another in their ability to understand complex ideas, to adapt effectively to the environment, to learn from experience, to engage in various forms of reasoning, to overcome obstacles by taking thought. Although these individual differences can be substantial, they are never entirely consistent: a given person’s intellectual performance will vary on different occasions, in different domains, as judged by different criteria. Concepts of “intelligence” are attempts to clarify and organize this complex set of phenomena. Although considerable clarity has been achieved in some areas, no such conceptualization has yet answered all the important questions, and none commands universal assent. Indeed, when two dozen prominent theorists were recently asked to define intelligence, they gave two dozen, somewhat different, definitions. – American Psychological Association

Some think that this is a “I say tomato, you say tomahto” kind of discussion, to the propos of this post you can choose any of them.

Scientists did demonstrated that intensive use of the internet does decrease our capacity to concentrate. Some people in possession of that fact concluded, (in my opinion and racionalization) wrongly, that because we can’t concentrate we are getting dumber… In my opinion the lack of concentration does not allow us to show how intelligent we really are. In my opinion lack of concentration is like a dirty window, it’s hard to see through it, but the inside of the room is there!

The ability to concentrate is very powerful, but it’s not everything. Never concentrated so hard on something and actually got stuck? And then left, watched the birds while drinking some coffee and returned to the problem with a fresh perspective and a rush of creativity?

Common sense states that if you know something, you don’t need google for it (ok common sense don’t mention google), and the more you know, more intelligent you are.

At a first glance you might think that common sense is right again, but lets not confuse intelligence with the ability to hold information! Yes intelligence is commonly followed by good memory, but not the way around. Rain Man had an extraordinary memory but performed very poorly on all the areas of intelligence! Einstein himself stated “Never memorize something that you can look up“. Google does help us a lot in this point!

In the business world intelligence is highly associated with the ability to solve problems. The internet and its vast amount of knowledge did not turn those who can use it properly more intelligent! Notice that these people did not solve problems! Other people have! They were intelligent enough to think that maybe someone else already had the problem that they’re trying to solve, solved it and posted a How To about it! but that’s it, no real creation. R&D people only use google to find out how ahead they are, compared to the rest of the world… they don’t expect to find a “how to solve my problem”, because if they do, whats the point on reinventing the wheel?

I would like to conclude quoting Voltaire:

Judge a man by his questions rather than by his answers.Voltaire