Monday, January 11, 2010

Programmer Thinking

Software development is problem solving. Simple enough, so why is it so hard?

The reason that software development is so hard is that we are solving many problems at once:

  1. Solve the problem conceptually.
  2. Design the user and data interfaces to allow the problem to be solved.
  3. Use the API and language to implement the solution.
  4. Create this in a context that executes the language and the APIs you have used so that it scales to the size of your user base.

There are a lot of assumptions too:

  1. You understand how to solve complex problems.
  2. You understand the problem domain which may be many domains.
  3. You understand your programming language.
  4. You understand many different libraries and standards to use as part of the solution.
  5. You understand principals of good user interface design.
  6. You understand basic principals of data design and perhaps database design.
  7. You can think through your basic knowledge of the items above in a way that can create a viable solution
The productive programmer has all these skills covered or has learned how to quickly learn any one of these quickly to fill a gap. Can you begin to see why programmers are a specialty?




Thursday, January 7, 2010

Shibboleth Software Developer Interviews

A Shibboleth is a type of test and was invented to look for impostors. Essentially you have a word that a foreigner can't say properly because their native language. This test goes all the way back to the Old Testament:

Gilead then cut Ephraim off from the fords of the Jordan, and whenever Ephraimite fugitives said, 'Let me cross,' the men of Gilead would ask, 'Are you an Ephraimite?' If he said, 'No,' they then said, 'Very well, say Shibboleth.' If anyone said, 'Sibboleth', because he could not pronounce it, then they would seize him and kill him by the fords of the Jordan. Forty-two thousand Ephraimites fell on this occasion.
So, first thing to notice is that this particular test resulted in a heavy penalty. The second is that if you have a speech issue, you are probably out of luck.

In WWII soldiers used a knowledge of baseball to detect friend or foe. Imagine if you were a football fan back then...

What I do like is that this a reasonably good test for interviewing software developers. I wouldn't worry about exact pronunciations, but phrases. Phrases are much more powerful indicators of impostors.

The one tool that I usually test a developer with is love and anger. Ask what the developer loves about the language or the API you need to have experience in. Then ask about what they hate. Unless you have great actors, they will fail these tests if they are not real experts or experience.

Don't just test your code, test your developers!

Friday, October 30, 2009

Artificial Stupidity

Artificial Stupidity (AS - pronounced rudely as you would expect) is an important discipline and I believe a growth area in computer science.

Look at the things we can do with AS:

  • Dumb monsters in games
  • Automating the news reporting at Fox News
  • Anticipating typos or mistakes
  • Turning off computers in the cockpits of airplanes that are overshooting airports
  • Politicians
  • Testing of artificial intelligence
  • Thesis committees for AI doctoral candidates
  • Better ways to annoy MS Word users with silly assumptions about spelling or formatting automation

Actually there are endless applications for AS. You could do a Turing Test that if the human agreed with the AS, we could confirm the human is a politician, mid level manager, or works for Fox News.

There are many places to learn about AS. For example, NASA. Not the space flight NASA, but the National Artificial Stupidity Association at the University of New Mexico.


Unfortunately this is sot something you can get a degree in. You have to specialize, maybe write a book or make it part of your doctoral thesis (writing one book is the equivalent of 300 blogs or a doctoral degree).

The funny thing is that there are already a lot of AS professionals (or is that AS pirates?). There are a lot of smart folks out there, but some are just plain bad. So, write bas AI, you automatically become an expert in AS.

AS's are everywhere! We have been awaiting self aware machine intelligence, but I think we see AS emerging right now all around us. Look at MS Word and its auto-formatting for wonderful example. Even though a lot of software was designed with traditional techniques and no AI or expert system code. Airline sites that pick only pricey tickets, shopping carts that forget what you bought, most applications have become 'self stupid'.

Monday, October 19, 2009

JRuby Trick: Saving time instrumenting Java classes

Ever with you could teach a class a new trick without wrapping or extending capabikities in a new class?

One of the issues I initially had issues with was extending Java to do cool things with Ruby.
First the Java class:

public BoringPig{
public String getName(){
return "name"
}
}

Being a Java guy, my first attempt at adding Ruby to Java looked like this:

class FlyingPig
def initialize(boringJavaObject)
@boringJavaObject = boringJavaObject
end
def flyPiggyFly
# ..... exciting stuff,
puts @boringJavaObject.getName+ " is flying!!!!"
end
end

But this meant I had to create a new Ruby instance. If I have a lot of objects, I ned to visit each one and create my Ruby version.

Instead, here is a cheaper way that simply adds the new method to the existing class

class BoringPig
# adds this method to any existing BoringPig objects or new instances of BoringPig
def flyPiggyFly
# ..... exciting stuff,
puts getName + " is flying!!!!"
end
end

Note that I don't need to fiddle with the initialize anymore. I also don't have a pointer to the object because the instance is the same. the "getName" could have been written as "self.getName", but self is implied.

To summarize, I have made a pig fly without creating a flying pig class.

Essentially I am extending the class rather than wrapping. Because Ruby is much more dynamic about when you add a method to a class definition, I can do this at any time for any reason. This could also mean that I could extend the class depending on the context and what I need to do. This is sort of like adding a visitor method directly to a class definition.

Why else would I do this? Basically I have a ton of Java in a very wordy API. I would like to reduce the churn of code to do things with these classes. For example, I have a class that has a very deep relationship that changes the classes use and context. Rather than create a wrapper for the new use and context, I can simply bubble this up to the methods of the root object. For you UML guys, I am adding stereotype info at the class rather than digging for it deep in the association of the stereotype tags.

Fun trick.

Pretty cool! This also meant my software runs a lot faster and takes a lot less memory.


Saturday, October 10, 2009

Like a Ruby in a Goat's A@@

I have been programmed in Java forever. Of course, there is nothing wrong with that.

Now I am learning and writing Ruby and specifically JRuby. The reason for JRuby is that I am calling the API in MagicDraw to get some things done that I have always wanted to do, but didn't have time to set up NetBeans or 'gasp' Eclipse every few months (I am Chief Architect of MagicDraw, so always working on the latest version).

I am sure that I could be writing Java, but I just don't have the time to do the setup. That's the key. You just run the scripts. No compile, no install, no waiting. There is a lot of pull.

I am also strangely attracted to Ruby (not in that way, the platonic language loving way). A few years ago I saw a lecture by Dave Thomas (of Pragmatic Programmer fame, not the founder of Wendy's), and thought that Ruby seemed compact and a rather useful language. But alas, every attempt to learn Ruby was thwarted by the chaos which is inherent in most languages... Drifting language, few standard libraries, and poor support. This has changed with the introduction of JRuby and the inevitable tread that comes with popularity of a language... sloth.

Now Ruby's pace as a syntax has slowed. Gone are the days that you can't test the latest article or book on your latest version of Ruby. Gone are the days of trying to match the right version of Ruby with some arcane GUI library. Gone are the constant changes to the language because when something is popular, change is discouraged.

There is still change, but it is additive. The GUI can now be based on Swing and I have that one in the bag. The implementation of JRuby runs on any Java JVM, so it works on any platform. Oh joy!

Things are not all good... Ruby is an interpreted language. There is no strict typing. Errors are at best cryptic for the new user. Learning Ruby is simply cool and like torture best left behind in the Bush administration because you'll never get a proper confession from a Ruby error message.

Well, with a presentation looming, I am forcing myself. I need to talk about PRR. PRR... well it is about rules as in expert systems as in artificial (pickled) intelligence and representing said rules in UML. All well and good, but what good are rules if you can't run them? So, comes Ruby to extract the rules and run them in Drools.

Well, very quickly between myself and the great aid of Gerald Meazell, up comes working JRuby extracting UML and spitting Drools! But, then came trying to get Drools to work... I panicked... Then I looked for a rule engine written in Ruby and found Ruleby!

Ruleby is based on the great work of one of my buddies, Dr Charles L. Forgy of Carnegie Mellon University. Dr Forgy invented the Rete algorithm which is simply the reason why expert systems work because it optimized the execution of rules. I'll get into Rete someday, but take my word for it, Rete is cool.

Long story short, it is all working and I am ready for my presentation at the October Rules Fest in Dallas (except for writing the presentation... the easy part). I am using JRuby, Ruleby, and Tenjin for my template language. I can even generate a Drools DRL file!

Ruby is still treating me like a reb head stepchild, but I am learning and Gerald, who is a bonafide and card carrying red headed stepchild, is helping a lot. More to come, even some code. Got great ideas and now I can find the time to script a few.




Sunday, September 13, 2009

The End of Dumb Software = The End of Dumb Thinking

Seth Godin is a marketing god. I say that because he very often exposes the obvious.

In Seth's latest blog, he talks about the End of Dumb Software. His point? Basically there is no reason for the stupidity of today's software. He is right. Sadly...

Seth's example is about the calendar app and mail on the Mac. It applies to any calendar or mail app I have ever used. There is a wealth of data, but the developers don't use it.

Many years ago I designed software that was not dumb. In fact it was what Seth is dreaming about. It understood who was important in your address book. It understood that 2am is not working hours and in fact would understand that you don't make appointments with friends and family during working hours unless it is for lunch or you were on vacation.

Where is this software? In a cardboard box in storage. Ericsson killed it. They couldn't see the utility. You might ask, how could they not see this as great? Well the VP of Ericsson I met was perfectly happy to silence the ringer on his cell phone by popping the battery off the back of the phone. In fact no Ericsson built phone had a way to silence the ringer and send a caller directly to voice mail.

That's why there is so much dumb software. Not that people are dumb, it is that they do not think. There is no analysis. It is epidemic. There should be billions of people like Benjamin Franklin, Albert Einstein, Robert Goddard, leonardo da Vinci, and other great thinkers. The problem is that most people don't explore the world with their minds. They are mentally handicapped by an inability to add two ideas together to create greater ideas.

I'll say this again and again. There are no stupid people, just a lack of people that don't use their brains and maybe never had the skills to think. People are generally lazy. It is not a degradation of their work ethic, they never had a work ethic because most people do as little as possible. That includes thinking and learning. We learn the minimum. Curiosity stops as soon as we get the information we need. The ideas stop when we solve a problem partially. Or worse, we stop thinking when a problem crops up and we don't bother to solve the blocking problem.

Smart software requires smart developers. I'll go farther and say that smart software requires renaissance thinkers. Programming and design is just a couple of your skills. Your primary skill is learning, exploring, curiosity, and invention. Then you can create smart software.

Please, if you have a pulse, please make a promise to yourself to be a renaissance thinker. Study everything. Mix ideas. Don't stop thinking at the happy path. Don't stop thinking when there is a problem. think until the problem is solved.

Wednesday, September 2, 2009

Ending an Argument

I found this a difficult entry to classify. I have several blogs that all deal with psychology and how it affects our decisions and beliefs. I think that computer science certainly deserves this one.

Ending an argument with a thought ending cliche sounds odd, but you have probably heard many of these if you have ever been in an argument with a software developer, manager, or customer. Simply it is a phrase that causes you to give up and not argue. It ends an argument abruptly and does not have a logical response.

Here are a few exmples:
  • "That's a Good Thing"
  • "Just forget it."
  • "...or the terrorists win."
  • "Be a man and..."
  • "We all have to do things we don't like."
  • "You are not being a 'team player'."
As you can see, they are insidiously generic. They could apply to anything, and that's the point. By not being specific, they are therefore false arguments.

Here is how it is defined in Wikipedia:

A thought-terminating cliché is a commonly used phrase, sometimes passing as folk wisdom, used to quell cognitive dissonance. Though the phrase in and of itself may be valid in certain contexts, its application as a means of dismissing dissent or justifying fallacious logic is what makes it thought-terminating.

The thing to understand is that when you hear these phrases, it means your opponent is unwilling to hear your arguments or your logic. In effect your opponent is unwilling to change their position.

What can you do against this? Well, not much really. When this sort of phrase is tossed out, the opponent has shut down to any discourse. Odds are they will just start getting mad or shut down further.

You can try to continue. Go for the gold! The olympic answer is that the phrase they just uttered does not apply to the specific argument. Challenge them to prove them wrong by having them utter the phrase after you state that the Easter Bunny is real or that teapots circle the Sun. Maybe it will work, but it is hard to get mental traction when someone has cognitive dissonance so strong they are unwilling to discuss a subject logically.

The best you can do is call foul (or fowl if arguing about chickens). Point to this blog and let them read it. Help them understand that they may not really have a reason to believe what they do and using a thought-ender is proof. Without evidence otherwise, you are winning and very sorry it is only because they are giving up by using such a cliche'.

Will that work? Hard to tell. Some people are unwilling to acknowledge that they are wrong. This is very strong as a past president has proven. The mind can invent many beliefs even believe these cliches' are logical and support their beliefs. The facts are, the brain is very afraid of being wrong and is deathly afraid of the cost of new beliefs.

If you can be wrong once, can't you be wrong again? The brain rebels at giving an inch because it could lead to a nasty trend.

Why fear of new beliefs? Simply being wrong means you are not a good provider and the wrong end of the genetic gene pool. If this at work, even worse. One bad belief admitted might show even more poor thinking and thus a reason why that person should be fired. As you can see, loosing an argument is like loosing a fight with a lion, proof that in the battle of the survival of the fittest, they are not so fit.

When this happens in the workplace, you need to be careful. Loosing is really bad for many people. They may already be fearing for their jobs, whether it is a justified belief or not. Leaders in companies also hate to have any questions to their authority. Programmers too are very sensitive to being wrong.

At work, you might want to be careful and defuse the situation. People are afraid of being seen as less than they are. The key thing is that we are all human. Everyone makes mistakes. I like to say in many situations like this that in some cases their may have been no other choice. Chalk it up to unavoidable and that anyone would have had that belief.

Here is the list of cliches' from Wikipedia.

Non-political examples

  1. "That's a Good Thing."
  2. "Why? Because I said so." (bare assertion fallacy—also “I’m the parent, that’s why” appeal to authority).
  3. "That’s a no-brainer."[3][4][5]
  4. "When you get to be my age..." (as in “When you get to be my age you’ll find that’s not true.”)
  5. "You don’t always get what you want."
  6. "What goes around comes around."
  7. "The best defense is a good offense."
  8. "Everyone is entitled to their own opinion." (appeal to ridicule if said sarcastically)
  9. "It works in theory, but not in practice." (base rate fallacy)
  10. "There’s no silver bullet."
  11. "Stupid is as stupid does."
  12. "Easy come, easy go."
  13. "Life is unfair."
  14. "Such is life."
  15. "It is what it is."
  16. "It was his time."
  17. "Whatever."
  18. "Yawn."
  19. "Be a man and..."
  20. "Think about it."
  21. "Just forget it."
  22. "...so, you do the math."
  23. "We will have to agree to disagree."
  24. "We all have to do things we don't like."
  25. "You are not being a 'team player'." (ignoratio elenchi).
  26. "That's just wrong." or "You just don't do that."
  27. "It takes all kinds to make a world."
  28. "Just do it."
  29. "That's a cliche."
  30. "That's what s/he said."
  31. "Don't be that guy."
  32. "Just look at me now."
  33. "Touché!"
  34. "Better to have it and not need it, than need it and not have it."
  35. "Because that is our policy."
  36. "Don't be silly."
  37. "There's no smoke without fire." (used to convince others that a person is guilty based on accusation or hearsay and to discourage further examination of evidence)
  38. "Your mom."
  39. "But...anyways...."
  40. "I'm just sayin'"
  41. "C'est la guerre"
  42. "Amen!"
  43. "So it goes."

Political examples

Thought-terminating clichés are sometimes used during political discourse to enhance appeal or to shut down debate. In this setting, their usage can usually be classified as a logical fallacy.

  1. "Racist." (Ad hominem attack).
  2. "That’s just a (liberal/conservative/libertarian/communitarian/etc.) argument." (association fallacy).
  3. "Socialism or Barbarism!" (false dichotomy)
  4. "'Anarchist organisations', isn't that an oxymoron?" (equivocation)
  5. "If you are not with us, you are against us." (or its opposite, "Who is not against us is with us")(false dichotomy)
  6. "Love it or leave it." (false dichotomy)
  7. "Support our troops." (ignoratio elenchi).
  8. "...or the terrorists win." (false dichotomy).
  9. "If you're not outraged, you're not paying attention." (false dichotomy)
  10. "Better Dead than Red!" or its inverse "Better Red than Dead!"
  11. "That's a conspiracy theory."
  12. "Freedom is not free." (Bare assertion fallacy)
  13. "Live free or die."
  14. "Fascist arguments need no comments." (weasel words)
  15. "If we gave it to you, we'd have to give it to everyone."
  16. "Freedom is non-negotiable."
  17. "Especially in this economy."

Religious examples

Thought-terminating clichés are also present in religious discourse in order to define a clear border between good and evil, holiness and sacrilege, and other polar opposites.[citation needed] These are especially present in religious literature.

  1. "God has a plan and a purpose."
  2. "The Lord giveth, and the Lord taketh away." Job 1:21
  3. "Adam and Eve, not Adam and Steve!" (opposing same-sex marriage)
  4. "God works in mysterious ways."
  5. "Trust in the Lord with all thine heart; and lean not unto thine own understanding. " Proverbs 3:5
  6. "Forgive and forget."
  7. "That's not Biblical."
  8. "Jesus loves you." (ignoratio elenchi)

The religious or semi-religious ideas of cults, heretics, and infidels are also often used as thought-terminating clichés, e.g. "Do not listen to him, he is an infidel," (a guilt by association fallacy) or "That line of thought sounds like a cult" (also a guilt by association fallacy).

Just for fun, in case you have read this far, here is a lesson on cults.