Retweet September 2011

From time to time I just blast tweets about software development, project planning, team dynamics, or whatever else comes to mind. Here is a synopsis of recent tweets and rants. If you want to follow the conversation follow me at techknow and/or juixe.

Software Development

  • Code. Money. Respect.
  • Software bugs don’t take anything personally.
  • Code more, sleep less.
  • DONT THREAD ON ME

Thought Leadership

  • Just having a goal is often times more important than the goal itself.
  • Word programming, i.e. writing TPS reports.
  • Code Complete = Tests + Implementation.

Product Placement

  • Google is the casino, or better yet the Goldman Sachs, of online identity, ads, and search. You don’t bet against the house.
  • What is cloud-accelerated web browser? Learning about Amazon Silk, the web browser in Amazon’s Kindle Fire.
  • The project code name for the iPhone’s auto correct is auto cucumber.
  • Spike TV should rename itself to Star Wars TV and the History Channel to Ancient Aliens Channel.

Money Angels

  • Dr Evil is starting a venture fund.
  • If Dr. Evil would have taken his Evil Corp. Public he would have made $1 billion on an IPO. And maybe Google would have bought his company.

Question

  • How many uses can you think of for a paper clip?
  • Where in the food pyramid is candy corn?
  • Is Meg Whitman the new Carol Bartz?
  • Are you changing the world or is the world changing you?
  • What is the person equivalent to having your car lifted up in the air and balancing its tires?

Randumb

  • The Internet made me do it.
  • It’s easy to earn money while you sleep, if you sleep on the job.
  • You are more likely to die due to medical error than a car accident. So if you are in a car accident, don’t go to the hospital, just walk it off.
  • If I could get a nickel every time someone gives me their two cents I would arbitrage people’s opinions.
  • Living the Internet lifestyle.
  • If you don’t want your naked picture hacked from your phone don’t take naked picture of yourself on your phone.
  • There are proposed bills that will make activities such as posting a lip sync video on YouTube a federal crime punishable with jail time.
  • Forget the war on drugs, in the future there will be a war on content.
  • History is not made, it is written, edited, scripted, and appropriated by Hollywood as a blockbuster movie about mutant super heroes.
  • I predict the past.
  • Beauty is in the eye of the beholder, behold yourself.
  • This is not Sparta!
  • Love me, hate me, but you thinking of me.
  • Love it or hate it, take it or leave it.
  • I love love and hate hate.

Overheard

  • OH: When you frown you look like a Klingon.
  • OH: Is everyone in the call on mute?
  • OH: My dress code is to try not to show my butt cheeks.

In Da Future

  • In the future, everyone will be a product guy.
  • In the future, Facebook will be your permanent record.
  • In the future, the revolution will start with a single tweet.
  • In the future, when people say they are going outside the grid, they will mean they aren’t logged into Facebook.
  • In the future, Android developers will need to program using the Android SDK and the phone maker’s proprietary SDK, and the carriers’s SDK.

Million Idea

  • Million Dollar Idea: A treadmill with a weight scale.
  • Million Dollar idea: there is so much artificial flavoring, color, and seasoning in food. Patent dinosaur meat flavoring.
  • Million Dollar Idea: Car alarm system that steams video of the surroundings of your car and scans for perps faces.
  • Million Dollar idea: wasabi guacamole
  • Million Dollar Idea: Carfax for people, including driving record, background check, work history, etc.
  • Million Dollar idea: pepperoni pizza flavored breath mints.
Posted in Java, Programming, Startup, Team, TechKnow | Tagged , , , , , , , , , | 1 Comment

Worst Software Bugs

We all have heard of missiles blowing up in midair because of the wrong unit was used in calculating the trajectory or bank software that misplaced millions of dollars because of a decimal place. It might not compare against blowing up a multi-million dollar missile but here are some of the worst software bugs I’ve seen in projects where I’ve worked.

Shift + O Short Cut – I once worked on a software application where one of the engineers developed a screen search functionality that would find the UI screen by name or feature. Needless to say the modal pop-up dialog for this search feature popped up when the user hit the Shift + O keys. This feature was developed by the engineer on his own initiative, so you can imagine everyone’s surprised when we couldn’t even type a capital o without this thing popping up.

Exposing Regular Expressions – In another project we developed micro expression language which was used and exposed at the application level to users. In one situation, a user reported a error when he wanted to replace a variable place holder with a dollar amount. It seems that when he called the expression language replaceall(“AMOUNT_VALUE”, “$0.00″) the got back the value of AMOUNT_VALUE.00. This problem was caused because we used Java Regular Expressions feature of the String class and $0 expression is a special value in the Java RegEx. This was like a Regular Expression Injection bug.

Localization and Internationalization – In the same project we had a problem with displaying the correct currency symbol used in a financial account statement. There is a big difference between $100 and €100. Account holders are not happy to know that their €100 are now worth $100.

Cut/Copy/Paste Does Not Work – I have seen way too many Java/Swing application where some component does not have proper support for cut, copy, or paste. When you cut from a Java application and paste to say Notepad you get a stringified Java object.

Textarea Size Limit – When filling online forms, the one bug that just kills me is where a textarea has a size limit not shown and you spend time typing a long response which will be either truncated, lost, or rejected on submit.

Posted in Programming, Rant, TechKnow | Tagged , , , , , , , , | Leave a comment

Fix Common Java Exceptions

ClassCastException – The most common reason for getting a ClassCastException is because the code in question is accessing an object from a List or Map and casting to an particular class, but the List or Map may have different types of classes. If you are not using generics and allow your List to contain any Object, instead of a specific class type, you’ll get a ClassCastException when you force a cast to one type but the object doesn’t descend from that class. A common fix is use Java generics or to check the type of a class before you force the case using the instanceof operator.

InvalidClassVersion – I’ve seen this exception often when working in a client-server environment. This exception is throw when you have two version of the same class in an environment. For example, maybe you made a large change and recompiled a particular class but only updated the server, the client still has a copy of an much older copy of the class. If objects of this class are serialized and shared between the client and the server you’ll an InvalidClassVersion exception. If a server sends a instance of a class to the client, the client who has an older copy of the class, will throw an InvalidClassVersion error because it’s version of the class may not have the newer methods, method signatures, fields, etc. The client version of the class is simply not compatible with the one in the server. To fix this, make sure that same version of any class is always used.

UnsupportedClassVersionError (Unsupported major.minor version 49.0) – This can happen when you compile an application in a higher version of Java then the version of the Java Virtual Machine in which you run the application. For example, if you compile your application for Java 6 but run the application using Java 1.4.2 you will get an UnsupportedClassVersionError.

NoSuchFieldException – A friend from school just sent me a message as to how to fix a NoSuchFieldException. I thought, just double check the library version, that JavaDocs, the source code, and anything else you can to verify that the field does exist in the class. This exception is thrown because he might be using reflection or some dynamic scripting language such as Groovy or JRuby and has misspelled the name of the field he is trying to invoke. The fix is to double check the API.

NoSuchMethodException – This exception is similar to NoSuchFieldException. You’ll see this exception when working with a dynamic language or when using reflection. When you use Java in a dynamic fashion, such as with Groovy or Java reflection, you don’t get the benefits of static compiled language features. You’ll get errors like NoSuchMethodException at run time instead of catching the error at compile time. It is often caused because you mistyped the name of a function that you want to use.

ClassNotFoundException – This exception can happen because you trying to run a class that references another class that is not in the classpath. Check the classpath and make sure that you have the classes and jars you need for you application to run. ClassNotFoundException often happens when you use third party libraries than themselves require other libraries or jars that you are unaware of.

NullPointerException – A typical Java NullPointerExeption is generally easy to fix with a stack trace of the exception. There is only one case where it is difficult to spot the source of a NullPointerException. The only NullPointerException that will have you baffled is those caused by auto-boxing, such as when you auto-box an Integer object to a primitive int variable. If the Integer object is null and you auto-box it to a primitive int when passing the object to a method whose parameter is an int, you’ll get NullPointerException. But if you look at the line where the exception is thrown, you’ll see that it takes an int and int primitives don’t throw exceptions, so you’ll be scratching your head in confusion until you realize that the calling method used an null value Integer object.

Posted in Java, Programming, TechKnow | Tagged , , , , , , , , , , | Leave a comment

Common Causes for Memory Leaks

You’ll always have to deal with memory issues, no matter the programming language. Even with the Java programming language, if the right precautions are not taken, you will have some sort of memory leaks, memory issue, out of memory exception, or heap size problem. I’ve seen two common types of memory issues in every application I’ve worked on.

A common source of memory leaks is global static singleton god object that collects or manages a lot of data, maybe a system cache, object lookup table, service locator, etc. This type of singleton pattern will require other objects to register with it, add themselves to the global pool of objects, but if they are not properly removed, unregistered, when they are no longer needed you will see your memory usage increase over time. I’ve seen this issue when using the callback or listener pattern and the listener object itself holds a lot of other data. This sort of problem is usually relatively easy to identify with a profiler, it will usually be one of the largest objects in your system.

The other, more difficult memory leak to identify, is when you have hundreds of thousands of objects each taking up a reasonable amount of memory. In this case, a single object instance will not take a lot of memory but collectedly the hundreds of thousands of objects can eat up a lot of memory. Here are a few things you can think about when dealing with a small class that spawns thousand of objects…

If you have int types, see if you can change them to short or byte types. Try subclassing if you have any number of properties that most often than not set or are null. Think about lazy loading arrays, lists, and other objects references. If there are many object instances of this class, and any portion of these instances are logically equivalent, think of using the flyweight pattern.

Posted in Design, Java, Programming | Tagged , , , , , , , , , | Leave a comment

The Four A’s of Email

I like to adhere to the AAAA rule of email. The four A’s of email reminds you to check you email for four items before you click the send button. Check and double check for correct Address, correct Attachments, correct Attitude and tone and state an Action you want from a recipient.

Recently, a developer in distress sent the following email to the whole company.

I can’t delete any data from any UI screen.

That test doesn’t read like an email, it doesn’t even make sense as a tweet, it’s like an unfortunate cookie message. The email should not have been sent to the whole team, which include sales people, it is to vague, does not have any clear action or request.

Communication is vital for any team and the teams running on full speed need the right level of communication in the right medium. If you are interested in learning how to effectively use email to communicate with your team I recommend the following posts.

There is a fifth A; don’t be an Ass.

Posted in Team, TechKnow, Tools | Tagged , , | Leave a comment

Keep Code Statements Simple

I don’t count my progress by the line of codes but at the same time I don’t take pride by over engineering a solution. Writing code is like writing for a publication, you have to know at what reading level you are writing for. That said, the one type of code statement that gets under my skin is what I call the run-on code statement. A Run-on code statement is one that has multiple method calls in one statement. Here is a made up example of a run-on code statement.

DataManager.getInstance().refreshData(obj.getAsInteger().toString());

In the above run-on code statement there are four method calls. I’ve seen worse. The reason whey run-on code statements are a pet peeve or mine is that if anyone method call fails because of a NullPointerException or some other error it’s difficult to quickly know what segment of the code statement failed. This is also annoying to debug if you want to step into one method out of the four.

Posted in Java, Programming, Rant, TechKnow | Tagged , , , , , | 2 Comments