Thursday, May 24, 2007

What am I doing here again?

We have a contractor at work. He's actually very nice, but I don't find him that competent. The questions that he's asked me so far have seemed like questions he should be answering himself...as in, Isn't this your job??

I'll try to explain the question he asked me in the non-geekiest terms possible. He is helping us set up an identity management (IDM) solution. In layman's terms, that means that someday, our users will not have to log in to every single application they use...once for Windows, once for email, once for each database, once for this application, once for that application, etc. They'll just log in to Windows, and everything else will "know" who they are. So anyway, he is setting up a connection between our current database of user information and the IDM solution. He has to call something to create a user, kind of like this (bear with me, you're going to see some pseudocode here!):

String firstName = "Heather";
String lastName = "Lott";
String password = "myPassword";
Statement statement = "insert into user(?, ?, ?)";
statement.setPlaceholder(firstName);
statement.setPlaceholder(lastName);
statement.setPlaceholder(encrypt(password));


Pretty simple, right? Everything's in a variable, and the password is encrypted before it's set (that's what the "encrypt()" around the password variable does). So he comes to my desk because the sample code I gave him (above), once he's modified it to use the connector stuff, is throwing an error, and he thinks the error is coming from my method (the encrypt()). The error is

Error near string [PASSWORD]

Now, he's getting the name and password out of a Map rather than setting them in variables (don't freak out, non-techies!! A Map is just a way to refer to things by their name! It's like going to the library and saying, "I want the book labeled 'First Name'"...then you are given the book and can see what information is inside.) Here's how he modified the code:

Statement statement = "insert into user(?, ?, ?)";
statement.setPlaceholder(myMap.get("FIRST_NAME"));
statement.setPlaceholder(myMap.get("LAST_NAME"));
statement.setPlaceholder(encrypt(PASSWORD));


Stay with me, non-geekies...anytime you have a String, it's in double-quotes. Anything NOT in double-quotes is assumed to be a variable.

Now, anyone see why he might get an error near PASSWORD??? There's no variable named PASSWORD!!! Hel-LO! Please turn on your brain! Or have some protein!! Do you even know how to program??

For the non-geeky, that last line should be

statement.setPlaceholder(encrypt(myMap.get("PASSWORD")));

Did any non-geekies understand me??? =)

4 comments:

Erin said...

Well I understood, and I'm not a programmer, but I am definitely at least a pseudo-geek (certainly significantly geekier than the general population), so I'm not sure that counts. :)

Susan said...

Hi, Heather - I haven't seen your blog until this morning, when I read your post on another board. I saw your name, and immediately thought of Cabdury's eggs! Hope you're doing okay!

TeresaB said...

I'm like Erin, not sure it counts that I knew the answer before I looked at what you'd written. I'm not a programmer, but apparently I learned, and have remembered, more then I thought when I was a QA manager. Scary!!!!! Poor TMTIH! Remember, it's hard to deal with the muggles sometimes, they just don't get it.

Heather said...

Erin and Teresa...I'll count it!! =) If I at least was able to explain it to "pseudo-geeks" (love it!), I'll call it a success!

Susan, my Cadbury egg savior!! Good to hear from you! (Yes, somehow one year I was SO busy around Easter that I never got to the store to buy some Cadbury Creme Eggs, and then they were GONE! Susan bailed me out by sending me some, for which I am eternally grateful!! =)

Old Geek-outs