City of Bridges

Bridges take us places over obstacles. They lead us from one place to another. They help us travel through life. Because of this, they should only be burnt when absolutely necessary.

Most people know this and attempt to follow the simple rule of “don’t burn bridges”. What a lot of us forget, myself included, is that bridges also need to be maintained. They need to be checked every once in a while. They need to be visited.

You are never more aware of this as when you are in need. What happens and you go to use a bridge you haven’t maintained in 10 years? Will the bridge even be there? If you are lucky then yes, it will be there and you can use it. At the same time, if you are smart you will give back to the bridge in some way. Maintain it, see if it needs anything.

Job searching is many times about bridges.

In Nov, 2010 I found myself in need of a job. Monster, Dice, CareerBuilder, they are all useful but nothing opens more doors than having someone already on the other side of the door willing to open it for you. This person is your bridge into the company.

They can open the door, they can get you in front of the right people, they can pop you to the top of the pile. They are your best asset in a job hunt. They should never, ever, be taken for granted.

You previous work colleagues are people you need to stay in touch with. If it’s a once every few months ping it’s better than nothing. You spend 40+ hrs a week with these people for who knows how long. They know you, they know how you work. Hopefully you made a good impression.

If you did they can help you. Don’t be ashamed to ask but don’t expect anything as well. They are doing you a favor. They are putting their reputation on the line to help you. Realize that and treat it carefully.

Pay it back. If someone helps you in the door, they are in a way stating ‘I speak for this guy. He’s a good guy. Can you help him out?’. That’s a big deal and if you don’t realize and treat it as such, the number of bridges you have will dwindle quickly. You need to pay them back. When they ask you for help, do it. It might be them in the same situation a year down the road. Don’t do what they did for you, do more. It’s great to be on the same footing with someone, its better if they feel they owe you.

They last statement may have caught you off guard, it may even seem cold, but it’s the truth. Every person who has helped me get my foot in the door, helped me cross a bridge into a company in an indirect way, I owe them. When called upon I’ll do at a minimum what they did for me. If possible, more. There is one caveat though: Don’t stick your neck out unless you believe the person can do the job.

It’s great to help a friend. It’s the right thing to do. But if they aren’t a fit for the job, tell them. Set the realistic expectations immediately. Never say “Well, I’ll submit your resume and let’s see what happens” when you know they are under qualified. You’re not helping them and you’re not helping yourself. Don’t get their expectations up but treat them with respect. A job is someones lifeline. It’s not to be treated lightly.

During my search I called upon a friend, I went and visited a bridge I hadn’t seen in a while. I knew it, and I’m sure he did as well so I went ‘cap in hand’. I was modest because I should be. Contacting someone after a few years to say “can you help me out” is a bit bold. I was lucky enough that we had a good working relationship when we worked together and he was also a truly nice guy.

At the same time the job I was looking for was very difficult. Maybe even out of my league. He played it correctly. “Go look at the job descriptions and tell me which ones you are interested in”. I did and contacted him. “Lets talks”. We did. He set the expectations. I might not have the math skills for one position but if I wanted to get my foot in the door I could try for the other. He didn’t put himself on the line for someone who might not be qualified for the job but he still helped me out. He established the expectations right from the start.

We build many bridges in this world and sometimes we have to burn some of them. Be careful which ones you burn. Be just as careful with the ones you may need in the future

Posted in Job Search | Tagged | Leave a comment

jLockit

I’ve done many projects where I needed some sort of locking architecture for my objects. Be it just determining if someone other than the current user should be able to operate on the object at a specific time or more global, like making sure only one user can use a certain part of a system at a time.

I’ve also been interviewing for a job a lot since being laid off from my current position (from a great company BTW, sad to go) and the number one thing I get asked about is the locking architecture I wrote in my free time over a weekend and brought to the company.

So, I present to you, jLockit.

jLockit is a small architecture I wrote for object locking. I searched the internet for something like this and all I really could find was database row locking ideas or something along those lines. Nothing really addressed locking an object based on memory locks and in a way that could be distributed (thanks EhCache!). jLockit is my version of a system that will allow the easy locking of an object, global locks, and a framework for work flow based on lock status.

I hope to have the time to maybe implement a Java Annotation version that would make it more lightweight (and would be great for work flow) but who knows when that time will be (just a heads up).

Posted in Java, Programming | Leave a comment

NoSQL

“I like Noh theater and I like NoSql”
“So you don’t like theater and you don’t like databases?”
“No, I love Noh theater, and I love NoSql”
“But you just said…..”
— Noh Theater is a type of Japanese Musical Drama

Normalize vs Denormalize

In college, when dealing with databases, I was taught Normalize, Normalize, Normalize. Use those foreign keys, don’t store redundant data, keep is small keep it simple, ‘Sir, the private’s weapon’s name is Charlene’ 🙂

One of my jobs involved getting 10-15 million records of new data a night. Another one involved significantly complex queries for most page loads because a 230 table db was highly normalized. This volume of records (which is really not much compared to most large scale public web sites) along with the frustration of constant query optimization has had me really thinking.

Why do we normalize so? Is it for data integrity? If so, who’s mucking around in the DB doing inserts and updates and operating outside of the business rule? A lookup table is great but is it worth the referential integrity hit in the long run?

Let look at a place where a foreign key appears to be a good idea at first:
Lets say you have a db with 500 tables. On each table you keep a record of who created the record and when (entry_creator, entry_created_ts). When you first design it you think to yourself, “Let’s make the entry_creator a foreign key on the employee table”. Sounds great. But what happens when you want to report on 20 of those tables and show the entry creator name? If you are sticking to strict ANSI SQL you’ll end up joining the employee table 20 times (there are other solutions such as in PL/SQL where you could load the table once and reference it, but let’s try to stay db agnostic).

So after a while you think, “Screw this, if I’m going to be reporting this type of stuff all the time, I’m going to put the employee name right in the table and just have the foreign key be the user name”. Your reports SQL gets much simpler and your SQL should execute faster. But what happens when the employee changes their name (say they get married or divorced)?. You now have to update every table where that name exists. When you do the update you could lock those tables for a bit (especially with a big table). Not the best solution.

But you might not be able to do even that. What if you have physical paper records with the persons old name on them. That record shouldn’t be updated. In that case you need to make a new employee and deactivate the existing one. If you were really thinking you might have added a field on your employee table named something like ‘old_employee_id’ so you at least had some type of history.

So where does that leave us? Well, it depends on the situation. In some ways the normalization (using the employee_id) allows you to easily change the name, but you would lose the history and your SQL would be slower and more complex. If you denormalize though (and consider renames a new employee) you get faster SQL and history of user names. To me, denormalization in this case is completely acceptable.

Referential Integrity

Even if we denomalize like above most people would still have referential integrity enforced on the field. It makes sense. You don’t want someone entering a name of an employee in a table and not have that employee exist. But wait, you have 500 tables all with referential integrity to the same table. That’s a lot of checks against the same table. What’s that going to do to performance? Every inserted (and perhaps updated depending on the smarts of the db) is going to do a check against the employee table. That can add up.

At my last job we tinkered with removing referential integrity for certain key tables (like employee) because of performance issues. I never got to try it and get a performance data but I’m betting you, under heavy load, you might see a difference.

My thoughts on referential integrity: Use it whenever you can but if you can get away with not having it, don’t.

Whats the point of the DB then?

This brings me to my main point. If you are going to go without referential integrity, why use an RDBMS at all? Most enterprise systems hopefully don’t have developers or sys-admins mucking around in the DB at a record CUD (create, update, delete) level. There are tools to help the admin so specific business rules are enforced. If you have the tools to make sure the data is OK, then just drop the referential integrity. The performance gain alone is worth it.

But then, what does the RDBMS really get you? Exactly! Not much (OK, I’m downplaying it here, but really, if you are reporting against a production system in real time? Shame on you. Warehouse it and hit that system) . Maybe it’s time to go with something else. Welcome to NoSQL.

NoSQL is (as defined by Wikipedia here) a data storage structure that is not relational in nature. The best way to think of it is a Hashtable of Hashtables of Hashtables. The first Hashtable is a key/value pair where the key is the name of your table and the value is Hashtables where each element is a key/value pair where the key is the primary key and the value is a Hashtable of column/data . I’m oversimplifying but it’s a good mental picture.

With a structure like this you are looking at a, what, O(3) performance ( O(1) per Hashtable )? That’s fast. With the correct denormalization you could really do some quick mining. Now, this doesn’t take into consideration the loss of SQL for joins, etc. But if the data is laid out in the correct data nuggets you won’t have to worry much. And most NoSQL solutions (such as SimpleDB) have a basic idea of multiple record retrieval.

Welcome to the Cloud

This is where Cloud computing comes in. And to me, it’s just lovely up there in the clouds (it’s all I could think of. Covered in extra cheese). Amazon S3 and Amazon SimpleDB are great solutions for systems that have identified that they could do without an RDBMS. Think of what that get you:

  • The servers are somewhere else. You don’t have to worry about ping and power for them
  • Their servers are have all the fail-over architecture already in place. You know what that architecture costs to build? Save your money!
  • Fast. As fast as your data pipe will allow you basically.

I just think its brilliant. Your company saves money because you don’t have to buy any hardware, you don’t have to hire that sys-admin and hand him a beeper, you don’t have to worry about scaling the hardware when the drives go full, you don’t have to worry about backups, and the list goes on.

Honestly, my next project, if I need a db that needs high availability and I don’t have to worry about FDA regulations, I’m going with SimpleDB and S3.

Posted in Database | Tagged , , | Leave a comment

RAID systems

Word to the wise. If you have a home RAID system like I do (4 SATA’s connected to an Adaptec 2810SA) you should physically label each drive when installing them. Why you ask?

Well, if one of them starts to fail (it’s why you got the RAID system isn’t it?) the card’s admin tools and start up diagnostics will say “DRIVE SDS2323 failed” or something of that ilk.

If you haven’t actually labeled the drives you end up doing a process of elimination to figure out which of the drives is actually failing.

Now, Maxtors actually play a nice tune when they fail. No, seriously, it plays a musical tune. But when you have four drives, side by side and still spinning, figuring out which one is playing the tune is futile.

So, label them before you turn them on and save yourself the headache later…

Posted in Hardware | Tagged | Leave a comment

Why get tested on Data Structures for an Interview

I posted a little status update on Facebook stating that I was looking for a job and needed to study Data Structures and Algorithms. One of my friends asked me why I needed to study this since I already knew the language I was going to be interviewed in.

Well, a lot of the ‘big brain’ shops expect you to be able to pick up a language fairly easy because once you know one, the others are, for the most part, a variation on a theme. So, testing on this really doesn’t show anything more than knowledge of an API (which you could quickly learn)

What they want to test is how you think and if you know when you should use certain things (not language specific). Data Structures is great for this type of test because it allows them to test if you know when certain structures are better than others. Algorithms prove how well you can think things through.

Now, I haven’t had to do any REALLY complex algorithms in quite some time and I haven’t really had to worry about performance to the degree of carefully picking what data structure to store things in. I learned all of this in college but that was 15 yrs ago.

So, time to study!

Posted in Job Search, Programming | Tagged | Leave a comment