Dec 3 2007

Favorite Programming Quotes 2007

Here is a list of great programming quotes from my readings over the last year. It is interesting to note that most of my reading material this year has been from blogs. There are just a great amount of programmer bloggers writing a lot of informative tutorials on every programming language, paradigm shift, and framework under the sun.

in my experience, one of the most significant problems in software development is assuming. If you assume a method will passed the right parameter value, the method will fail.
— Paul M. Duvall
Continuous Integration

Programming languages are like girlfriends: The new one is better because *you* are better.
— Derek Sivers
7 reasons I switched back to PHP after 2 years on Rails

The sooner we start coding fewer frameworks and more programs the sooner we’ll become better programmers.
— Warped Java Guy
Elementary Java Solutions

Starting a startup is hard, but having a 9 to 5 job is hard too, and in some ways a worse kind of hard.
— Paul Graham
The Future of Web Startups

In essence, let the market design the product.
— Paul Graham
The Future of Web Startups

A startup now can be just a pair of 22 year old guys. A company like that can move much more easily than one with 10 people, half of whom have kids.
— Paul Graham
The Future of Web Startups

Startups almost never get it right the first time. Much more commonly you launch something, and no one cares. Don’t assume when this happens that you’ve failed. That’s normal for startups. But don’t sit around doing nothing. Iterate.
— Paul Graham
How Not to Die

The key to performance is elegance, not battalions of special cases.
— Jon Bentley and Doug McIlroy

You’ll spend far more time babysitting old technologies than implementing new ones.
— Jason Hiner
IT Dirty Secrets

To Iterate is Human, to Recurse, Divine.
— James O. Coplien

No one hates software more than software developers.
— Jeff Atwood
Hanselminutes Podcast 74

I was a C++ programmer before I started designing Ruby. I programmed in C++ exclusively for two or three years. And after two years of C++ programming, it still surprised me.
— Matz
The Philosophy of Ruby

Good architecture is necessary to give programs enough structure to be able to grow large without collapsing into a puddle of confusion.
— Douglas Crockford
The Elements of JavaScript Style

Programming is difficult. At its core, it is about managing complexity. Computer programs are the most complex things that humans make. Quality is illusive and elusive.
— Douglas Crockford
The Elements of JavaScript Style

Code reuse is the Holy Grail of Software Engineering.
— Douglas Crockford
The Elements of JavaScript Style

The structure of software systems tend to reflect the structure of the organization that produce them.
— Douglas Crockford
The Elements of JavaScript Style

The definition of Hell is working with dates in Java, JDBC, and Oracle. Every single one of them screw it up.
— Dick Wall
CommunityOne 2007: Lunch with the Java Posse

Suppose you went back to Ada Lovelace and asked her the difference between a script and a program. She’d probably look at you funny, then say something like: Well, a script is what you give the actors, but a program is what you give the audience.
— Larry Wall
Programming is Hard, Let’s Go Scripting…

I went to school to learn how to program software applications, which inevitably have bug defects. There was no course at my university on testing, debugging, profiling, or optimization. These things you have to learn on your own, usually in a tight deadline.
— Juixe TechKnow

To most Java developers, Ruby/Rails is like a mistress. Ruby/Rails is young, new, and exciting; but eventually we go back to old faithful, dependable, and employable Java with some new tricks and idioms and we are the better programmer for it.
— Juixe TechKnow

You might as well pay your customers 50K because they are just your QA.
— Juixe TechKnow


Nov 16 2007

Developing Your Programmer’s Intuition

The other day I solved a bug. I didn’t think much of it. The bug basically manifested itself when the user search for data but none was returned. We write an ‘enterprise-grade’ software application, so there is a lot of code and tiers between clicking the search button and displaying the data in the client. But in thinking about this bug I had pin pointed only a few methods in a few classes. The problem ended up being that in the database there was a value that was padded with an extra white space and one of the SQL queries used returned an empty set. I didn’t think much about the fix to the bug, but when I described the problem and solution to my coworker he said, ‘How did you know there was an extra whitespace? I would never have thought of that, you can’t tell if there is a white space by just doing a select.”

I think that as software programmers, we do develop of certain intuition that allows us to better understand software. This code sixth sense aids us in debugging, problem solving, and trouble shooting your own code, as well as third party applications. After seeing soo many null pointer and cast class exceptions, you develop a noise for sniffing out smelly code.

Here are a short list of root causes for stupid bugs I have encountered. I have seen bugs in hash maps because the key is case sensitive. I have seen a lot of problem when trying to parse a file extension type and someone uses the String’s indexOf (use lastIndexOf instead). You are comparing the equality of a string against a string literal, code defensively to avoid null pointer exceptions (“LITERAL”.equals(stringVariable)). Encapsulation means nothing if you provide a public getter and setter for every field for every class. Code against interfaces. Objects that are are globally cached should be immutable. Runaway memory leaks are caused by maps that cache large objects that are not removed. In batch files, you need to quote paths if they have spaces.

If you are a novice programmer you can read into smelly code and try to write effective code to develop your programmer’s intuition. Programmer’s intuition is developed through experience.

Technorati Tags: , , , , ,


Nov 13 2007

Java Outlook Connector 2.0 Review

If you work with Java and need to access meetings, contacts, emails, etc from the users Outlook, you could have done it using Groovy and Scriptom. But to write Java code, instead of Groovy code, you can use Java Outlook Connector (JOC) from Moyosoft. JOC is basically a wrapper to COM for accessing Outlook. Once you have added JOC to your project and you have imported the JOC classes you can write code to read and write data to outlook. Here an example that reads your contacts and prints out the full name and company name for each contact…

[source:java]
// Get Outlook Application
Outlook outlook = new Outlook();

// Find default Contact folder
OutlookFolder contactFolder = outlook.getDefaultFolder(FolderType.CONTACTS);

// Iterate over the contact items in the default contact folder
for(ItemsIterator j = contactFolder.getItems().iterator(); j.hasNext(); ) {
OutlookItem item = (OutlookItem)j.next();
// Verify that the item is a contact
if(item.getType().isContact()) {
OutlookContact contact = (OutlookContact)item;
// Print some contact info
System.out.println(“Full Name; “+contact.getFullName());
System.out.println(“Company; “+contact.getCompanyName());
}
}

// Get contact subfolders
FoldersCollection contactFolders = contactFolder.getFolders();
for(FoldersIterator i = contactFolders.iterator(); i.hasNext(); ) {
OutlookFolder folder = (OutlookFolder)i.next();

for(ItemsIterator j = folder.getItems().iterator(); j.hasNext(); ) {
OutlookItem item = (OutlookItem)j.next();
if(item.getType().isContact()) {
OutlookContact contact = (OutlookContact)item;
// Print contact info
System.out.println(“Full Name; “+contact.getFullName());
System.out.println(“Company; “+contact.getCompanyName());
}
}
}

// Dispose the library
outlook.dispose();
[/source]

Here is another example that lists all folders (contact, meetings, inbox, etc) from Outlook in a neatly indented format. In this example I will create a function which will call itself recursively for subfolders.

[source:java]
public static void searchFolders(FoldersCollection folders, String indent) {
// Iterate over outlook foldres
for (FoldersIterator fi = folders.iterator(); fi.hasNext();) {
OutlookFolder folder = (OutlookFolder)fi.next();
// Print the folder name
System.out.println(indent+”Folder Name; “+folder.getName());
// Recursively search subfolders
searchFolders(folder.getFolders(), indent + ” “);
}
}
[/source]

To invoke the searchFolders method to actually print out all the folders in Outlook, I would use code like the following.

[source:java]
// Get Outlook Application
Outlook outlook = new Outlook();
searchFolders(outlook.getFolders(), “”);
// Dispose the library
outlook.dispose();
[/source]

Again, for the above example to work you need to add the joc and moyocore jars to your project. Once these jars have been added you can import them. All the code in these examples throw exceptions which has been omitted to keep the samples simple.

Java Outlook Connector has support for Outlook notes, meetings, mails, contacts and more. If you are a Java developer that has to write software solutions that integrate with Outlook, you might already have discovered the usefulness of Java Outlook Connector.

Technorati Tags: , , , , , ,


Nov 11 2007

2008 JavaOne Call for Papers

If you ever wanted to be a speaker at JavaOne, you have until November 16 to submit your proposal for technical or Birds of a Feather sessions. Last year a big theme was Java scripting with Groovy and JRuby and I expect this to be a hot topic at the JavaOne 2008. I also think that there is enough interest that some technical sessions will be devoted to Scala. Web frameworks that depended on these programming languages, such as JRuby on Rails, Grails, and Lift, would be great Bird of a Feathers sessions.

At JavaOne 2007, some popular sessions where those that pimped out business application GUIs, such as the Filthy-Rich Clients talks by Chet Haase and Romain Guy. Anything session talk that promises to jazz up an application UI will definitely be well received. Last year, Sun made a big splash by announcing JavaFX Script and I am sure there will be a lot of interest on this technology at JavaOne 2008.

If you think you can give a talk on any of these topics, you have until November 16 to submit your proposal. Good luck and see you there at JavaOne 2008!!

Technorati Tags: , ,


Nov 5 2007

The Programmer’s Text Editor

Software programmers love things that are free, such as free and open source software and freeware. Developers also love their text editors. Over my development experience I have used a ton of editors. As a programmer I like an editor with code and syntax highlighting, code folding, tabs, and all the bells and whistles.

Here are the top text editors that I use, in no particular order. All of the text editors listed below are installed in my home and development machines.

  • jEdit – The primer Java-based editor.
  • Vim – Vi Improved.
  • Scintilla SciTE – My Windows-based editor of choice.
  • Notepad++ – Free source code editor and Notepad replacement, based on Scintilla.
  • Notepad 2 – Also based on Scintilla.
  • Komodo Edit – Free editor based on Komodo IDE. Komodo Edit has a nice FireFox extension project support.
  • Jext – Free source code editor written in Java.
  • ConTEXT – ConTEXT is a small, fast and powerful freeware text editor.
  • TextWrangler – My favorite general purpose text editor for Mac.

Even though they are not free, there are some great commercial text editors too. Many Rails enthusiasts use TextMate on OS X. I also seen a lot of programmers use UltraEdit.

If I missed your favorite text editor, feel free to tell me about it in the comments. I’m always open to try a new editor out.

Technorati Tags: , , , , , ,


Oct 29 2007

Microsoft Power Tools for Windows XP

With all the bad press about how horrible Windows Vista is, and the fact that Mac OS X Leopard doesn’t much have support for the latest JVM, I think I will be sticking around with Windows XP. Here are some free Power Tools from Microsoft which can make your Windows experience just a bit more pleasant.

XML Notepad 2007
It’s no XML Spy but it is free and it is all you need for viewing or editing simple XML files.

XML Notepad

PowerToy Calc
Allows you to graph custom functions. You can also save the graph as a bitmap.

PowerToy Calc

Alt-Tab Replacement
When you have too many windows open, you can hit Alt+Tab to view the icons of open windows so as to find the one you need quickly. Alt-Tab Replacement adds a small thumbnail of the application window in addition to the application icon.

Alt-Tab Replacement

Virtual Desktop Manager
Adds four virtual desktop, like Leopard Spaces. In each virtual desktop you can place and arrange different applications and easily click through each desktop. From the Taskbar, right click and select Toolbars | Desktop Manager. At the right hand side of the taskbar you will see the numbers 1 through 4, which represents one of you

Image Resizer
Right click on images and select ‘Resize Pictures’ from right click menu.

Open Command Window Here
This small application installs a new right click menu option. You can right click on a directory and find a new Open Command Window Here option which when selected will open a new command prompt positioned at the chosen directory.

Technorati Tags: , , , , , , ,