A Good Reason to Fire a Programmer

During the last 12 hours I had to fill out a registration form on one Web site and purchase a bus ticket one another. Both user experiences (UX) made me really sad. The reason “s the same: software developers don “t give a shit about their profession. They simply don “t care.

UX #1.

The site registration form had a half dozen fields to fill out, which I did. After pressing the Submit button, just one thing has happened: the border in the box where I entered the user ID became red. That “s it. No error messages. I had a feeling that, for some reason, they didn “t like the value I “ve selected for my user id. Was it too difficult to show a short message explaining what did I do wrong? Maybe their software developers don “t know how to display the validation error text? Not the case.

After changing the id and pressing the button Submit again, the following text was displayed on top of the window: rdquo;One or more entered values are wrong. rdquo; This time the red border was surrounding the box where I entered the phone number. Is it hard to show the format you expect? I “m not even asking you to use a pre-formatted field hellip; OK, I guessed the required format. But I had a feeling that this unknown software developer just spat into my face and is giggling behind the monitor “s glass.

These phone entry field are poorly programmed in every other form I fill out. Have you seen the validation message like “Please remove all dashes and spaces from the phone number rdquo;? Any programmer who wrote anything just a little bit more complex than “Hello World rdquo; should know how to programmatically remove all unwanted characters from the string. Or maybe they don “t?

The next job interview I “ll start with writing the following phone number on the piece of paper:

1 800 555-1212

Then I “ll ask this candidate with the resume having the word Senior all over it to write the code removing anything but digits from this text. If he “s not done within 5 minutes, the interview “s over.

UX #2.

This morning I was purchasing online a bus ticket to go from Manhattan to New Jersey (a one hour ride). The address section had a text area where I “ve entered my address and below was a dropdown titled Country and populated with a hundred or so entries. Why in the world it starts with Afghanistan? Is this particular bus route popular among the Afghan citizen? Is this even safe to ride on this bus? What did the developer and his incompetent boss were thinking about? They were thinking about anything but the people who would be using this Web site. Does it require MS in Computer Science to add United States at the top of the list of countries? They don ‘t care.

It “s really sad. Random people are developing software. On the UI side they get away with such quality because people are too forgiving and don “t know any better. On the server side they survive because the hardware became very inexpensive. Instead of writing efficient code, they throw more CPU or scale horizontally by adding more commodity Linux boxes. Waiting to see how these so-called programmers will survive in the mobile space where both memory and CPU are not scalable, at least now.

I know that UI developers working in our company read this blog. Guys, if you “ll deploy an application in QA with the UI showing such disrespect to the users, you are fired. Nothing personal, but this would indicate a serious issue with your attitude toward your profession. You don “t belong here.

Advertisements

Java 7: The Most Confusing Feature

Java 7 has this new feature – now you can add the keyword final to the catch clause. This feature is pretty confusing. I tried to find bits and pieces that would make me wanna write the final qualifier in front of the exception ‘s type. This blog didn ‘t help much.

I wrote a little program below that purposely divides by zero. This program works with or without the final keyword, and the output is the same. I ‘d appreciate if someone would give me a clear code example (just the code, please) that would show why this confusing feature has been added to the language.

public class TestStackTraceJava7 {

TestStackTraceJava7() {

try{

divideByZero();

} catch (ArithmeticException e){

System.out.println( “Don ‘t divide by zero! “);

}

}

// This won ‘t compile: int divideByZero() throws Exception {

int divideByZero() throws ArithmeticException {

try{

int i=25/0;

} catch (final ArithmeticException e){

System.out.println( “Caught ArithmeticException and rethrowing… “);

throw e;

}

return -1;

}

public static void main(String[]args){

new TestStackTraceJava7();

}

}

Update. I ‘d like to thank Aleksander Borisov, who responded to my post and created an example that illustrates the usage of the final exceptions.

But the question remains the same, “Why making the language more confusing than it has to be? ” Just look at this code snippet from the Alexander ‘s post:

private void throwExceptions() throws A, B, C {

try {

throwAccordingToIndex(new Random().nextInt(2));

} catch (final Exception e){

System.out.printf( “Caught %s and rethrowing…%n “, e);

throw e;

}

}

Basically this code reads, “Even though I ‘m catching only Exception, actually, it can be one of the three types of Throwable objects: A, B, or C. I need to rethrow it to the caller anyway, and by the time the caller will get it, the type Exception will change back to one of three: A, B, or C “. To make things even more confusing, writing the keyword final here is not mandatory.

Currently, I ‘m teaching a Java class for the beginners, and tomorrow session happens to be about Java exceptions. I ‘ll just briefly mention that Java 7 introduces a confusing and not overly useful feature called final rethrows. Take a note of it, but you can live happily without ever using this feature.

Actually, I know one use of it, and if I ‘m not going to fall asleep on the bus while going home from work, I ‘ll write an blog describing a quite unusual scenario when final exceptions may help you. Stay tuned…

Water-Damaged iPhone

A week ago my 17 y.o. son dropped his 3 month old iPhone 4 into a hot tub. Guess what, it stopped working. To be precise, the camera flash was producing a steady light, and this was it. Using your smart phones and iPods by any types of water containers (including toilets) is not smart. Water damage is not covered. Apple put this special Liquid Contact Indicator inside the iPhones, which tells to the service technicians if the phone has been sunk.

Needless to say, my son was upset. His income from working part time at the local library is modest, and the last thing he was planning to spend it on was paying several hundred bucks for a little mistake he made.

These days when a young kid needs to find out how to fix something, he/she goes to a reliable source like Youtube ,Yahoo Answers. A guy on Youtube shared his story how keeping an iPhone in a container with rice for a couple of days fixed his iPhone. Rice is known for its water absorbing abilities.

Three days in a rice somewhat helped. The ability to make and receive calls came back. There was a little inconvenience though ndash; the screen remained pitch black. My son has good memory though and remembered the areas on the screen where the phone buttons were before the accident. The the voice activated feature came handy. Saying “Call Dad ” made the iPhone obediently dial my number.

After a week without this device my son said how this issue with the iPhone gave him a peace of mind ndash; no need to text, check emails and facebook that often. Yeah, right! Tell me about peace of mind, kido!

On Saturday, I asked him what “s the status of this rice-recovery process. He replied that it “s pretty much hopeless. I felt really bad for him, and started thinking of how to help. Giving money for a new phone was out of the questions ndash; I “m not that kind of a parent. Breaking the 2-year contract with AT amp;T and getting into a new one is expensive. So I said, “Make an appointment at the Genius Bar at the closest Apple store, let “s go there, tell them the truth, and get an estimate of the repair cost. ”

Two hours later we entered the store and my son bravely said, “I dropped my phone into the water, and then did this rice thingy hellip; ”

The technician smiled, “This rice thingy might help in the beginning, but the hardware is damaged and it “d show up some way later. But let “s see hellip; “.

Then he took out the SIM card and carefully examined its holder. “The replacement will cost you $199. Think about it while I “ll check your account. ”

The next comes the dialog between me and my son

“Do you want to pay $199? ”

“I “d like to check all my other options first ”

“But you don “t have many options, do you? Do you have money on your account? ”

“I do, but before paying I “ll like to check my other options ”

“What if I “ll pay half? ”

“Thank you, but I “d like to see what else can be done ”

The guy comes back and says to me, “You “re a good customer and, as an exception, we decided to replace this phone for free. ”

A minute of silence… Two smiles hellip; Three smiles hellip;Thank you, thank you, thank you hellip;

Ten minutes later we left the Apple store, the place that carries the great devices and can turn an issue into a fun experience. And this was not the first time they did it to me!

My son was so happy carrying a new iPhone 4 (I guess, it was a refurbished one , but covered by a regular warranty)! He said, “Honesty is the best policy! ” It really is. I replied, “Steve Jobs for President! “

Java Veterans, Brush Up Your Java

During the last two months I “ve interviewed a number of senior Java developers for a position at the financial firm. Vast majority of them have 10+years experience working with Java on real-world financial applications. They have lots of interesting projects on their resumes, know how to present themselves, are self-confident, and claim the expert level of Java knowledge.

But it seems that most of them assume that just spending years working on Java projects is enough for considering themselves Java experts. The fact that you “ve been using Hibernate, Spring, JMS, and some caching framework doesn “t make you a Java expert. Over the years you might have improved your understanding of the architecture of Java EE applications, but this doesn “t not make you a Java expert.

Back in 2004, Java 1.5 has been released. Besides generics and annotations it introduced the library of classes supporting concurrency. I don “t care if you know generics, but this library is golden, especially for Java developers who are applying for working on financial applications. Many of these Java veterans never bothered looking into the latest Java features for years. And if I “m asking any concurrency-related question, a typical answer is “Oh yes, I remember there were some new classes that can do this. rdquo; Some new classes? Come on, they were in Java since September of 2004!

If a job applicant believes that the only two ways to create a Java thread are extending a Thread or implementing Runnable, he ‘s not a senior Java developer regardless of how many years he spent working on Java projects. This tells me that this person doesn ‘t care about Java and is not interested in keeping his technical skills current.

This is one of these “less is more rdquo; situations. People who have learned Java after 2004 are more likely to know it better. My message to Java veterans is simple, “If you want to compete with young kids, spend some time learning Java programming. Become competitive as you were ten years ago. Otherwise your only option is to complain about the outsourcing that may take away your job any day. rdquo;

If President Obama Would Run an IT Project

What do you need to do to bring a software development project to a dead end?

Get a group of software developers and give them a manager who never managed an IT project before, but is a skillful oracle who can convince business users that his team is working as planned, is moving in the right direction, and will produce good results. Important: at any cost avoid setting any deadlines and deployment dates – not even for the alpha releases.

During the first year, the business users wouldn “t expect seeing improvements in software because the previous team lead used the wrong architectural principles, wrong design patterns, didn “t use Ruby on Rails. Besides, who said that creating a cross-platform state of the art software should be easy?

The biggest enemy of such project is agile methodology. No two-week sprints showing any intermediate results are allowed. Insist on the waterfall management style, which requires a couple of years just to produce the project documentation.

Software developers working for such manager will quickly figure out that they are allowed to spend most of the time working on their pet projects. But if Google employees can spend only 20% on pet projects, in this team it “s close to a 100%.

Our charismatic manager will keep convincing project stakeholders that the headcount and the budget for his team needs to be increased. One of the reasons for new funds is waging a new flame war with Java developers from the 15th floor. The goal is noble ndash; to explain them that since all software development on the 13th floor is done in Ruby and Rails, the 15th floor would also benefit from using this great technology for quick prototyping. Conventions over configurations rules!

A couple of years later, this war can be used as an excuse, “The war with the 15th floor created holes in our budget, so we could not complete own project and need more money rdquo;.

This manager would keep generating new internal projects. Massive code refactoring is a great candidate for this! Every developer will be able to convince any outside auditor why replacing this piece of code with that one is the right thing to do. Developers will do it sincerely and with high energy. No ROI? Well, you can “t measure everything with simple arithmetic. Restructuring the code and making it more readable is clearly a great project for future generations who may want to read and reuse our software components.

Unfortunately, the day may come when the business users/stakeholders will notice that in a couple of weeks they can run out of money. No, literally. Now this project will have to be either closed or outsourced to India with mandatory relocation of the entire team from Washington DC to Bangalore. All of a sudden, the angry business users will become hyperactive and will start putting enormous pressure to our IT team (they even force the team to work on the weekends, no kidding!). Dear business users, didn “t you see this manager was pulling your legs from day one? Or maybe you knew it all along, but wanted to enjoy seeing this incompetent C-level manager on his death row? You got it now. The project is terminated. Who “s happy?

The job has to be done anyway. Put up a new job description for another project manager, but make sure it includes the following clauses:

“Deep familiarity with the agile development methodology is a must. Successful large-scale projects must have traceable references with a proven track record. “

Thank you, Java annotation!

This was an interesting bug hellip; I was working on a Web application, where Adobe Flex client was sending an instance of an ActionScript WrapperObject to the Java server, which was supposed to invoke some JBDC code to run an SQL Insert statement saving the data from the Java version of WrapperObject in the database. I wrote all the pieces of Flex, Java, and SQL and started Tomcat in Eclipse IDE.

The Web browser displayed my window, I filled out the form populating the ActionScript WrapperObject and pressed the button Save. Nothing happened. No errors and no data inserted in the database.

Well, need to start debugging hellip;Let “s see what could have gotten wrong:

1. I didn “t properly populate the ActionScript WrapperObject

2. I didn “t properly configure the Java class/method so the front end didn “t even call it.

3. I didn “t code the database portion properly.

But why there is no errors? Starting the Flex part in the debug mode quickly revealed that the WrapperObject was properly populated and the asynchronous request to the Java server has been sent.

Great. The next question is, “Have I called the proper endpoint (the destination) on the Java side and if the correct method has been really invoked? rdquo; Started an HTTP/AMF sniffer, which confirmed that I was calling a method on the endpoint mapped to the class Customer shown below. On the Java side, the class hierarchy looked as follows:

class _Customer {

hellip;

public boolean saveData( WrapperObject wrapper){

// an empty method

}

}

class Customer extends _Customer{

public boolean saveData (WrapperObject wrapper) {

// the code saving data in DBMS was here

}

}

Without leaving Eclipse IDE, restarted Tomcat in the debug mode and put a breakpoint in the caller of Java “s saveData. Interesting hellip; The debugger brought me inside the empty method of _Customer.saveData. Do you see any spelling errors in the method signatures? Me neither. This was about time to use a Java annotation @Override, which I was always underestimating. Changed the class Customer to look like this:

class Customer extends _Customer{

@Override

public boolean saveData (WrapperObject wrapper) {

// the code saving data in DBMS was here

}

}

Sure enough, the Java compiler immediately told me that the method saveData has to override the one from the superclass. But I did override it, didn “t I?

The problem was that my project has two different versions of the class WrapperObject located in different packages! The superclass was using the WrapperObject from one package, but the subclass from another! This little annotation caught what my eyes didn ‘t see. Fixed the import statement in the subclass to properly override the method saveData, re-ran the program and got hellip; an SQL error stating that I have an extra comma somewhere in my Insert statement. But this one is a piece of cake! I was so happy.

Thank you Java @Override ndash; you made my day!From now on I ‘ll be using this example in all my Java classes.