Tuesday, March 9, 2010

NetBeans and Qt

Introduction
I originally started this blog with the idea of building an Android application and recording my experience.  School, work and other activities have sent this in a totally different direction.  I still plan on recording my development experiences here, the actual topics, though, have changed.

On to the reason for this post.  I was recently asked if I would be interested in doing some work writing an interface to a financial trading system.  The gist of the project is this - write an application that polls the market data specified, runs an algorithm against it, and notifies the user if the algorithm meets a certain threshold.  The makers of the software have conveniently supplied an API to read their data streams.  In fact, they have supplied an API for C++, Java, and POSIX.  Being a native Java developer, you would think that I would immediately go for that solution to the problem.  The truth is, if I end up doing this, that will be my likely path.

When I got to thinking about the problem domain, however, I thought I should be prepared for a different build. First off, consider the basic description - get market data, perform analysis, give result.  This is clearly intended to give the user the proper information to make a decision about a trade, and then act on it.  Clearly, the faster the application works, the better.  Now consider an application running in the JVM.  Basic operations between Java and other languages, given the high quality JIT implementations these days, is minimal.  I wouldn't expect to see a significant performance hit using Java as opposed to C++.  The second consideration, though, is garbage collection.  If I implement the system poorly, there may be periodic delays due to garbage collection. Heck, if I implement it correctly there may be delays.  Now I have to consider whether I think this will actually be an issue, and the answer is, probably not.  I can take actions to minimize GC and optimize the return of the results.  This got me thinking, though.  It would be nice to be able to write this in C++.  So I decided to make sure that I could.

The Development Stack


After some brief research I decided to go with the Qt library on NetBeans.  You can learn more about Qt here.  Why Qt and NetBeans?  Well Qt is an LGPL, cross platform component library with a neat Visual editor.  NetBeans is a high-quality Open Source IDE, with a lot of support for C++.  I could have gone with Eclipse, which is my primary IDE, but NetBeans has always had a leg up on this type of development in my book.

The Setup


NetBeans even has a nice tutorial on how to configure and set up a Qt project.  Too bad it is no longer accurate (Nod to Steve, "Yes this is another case of an OS project documentation being out-of-date").  Here is what I found:

  • The tutorial instructs you to install mingw, qt and msys separately.  This is not needed if you are using 4.6.2.  In fact, this won't work.  
  • This post suggests that Qt changed the version of the compiler they use in the latest bundle, and that they include mingw with the distribution.  
So, here is my short list of steps you need to follow to get Qt working with NetBeans:
  1. Make sure you have the JDK and NetBeans installed
  2. Make sure you have NetBeans C/C++ plugin 
  3. Install msys1.0 (As easy as following the defaults in the installer)
  4. Get the Qt installer, Full version. Follow the defaults  (The NetBeans tutorial says to only download the Qt libraries)
See how easy that was?  Much easier than the NetBeans tutorial suggested.  To make sure you can compile a  Qt project, there is one configuration item left.  Make a MinGW_Qt Tool Collection. 
  1. Go toTools->Options, C/C++.
  2. Click Add...
  3. Select the Qt mingw installation as your base directory (mine is at: c:\Qt\2010.02.1\mingw\bin
  4. Select mingw as your tool collection family.  Your collection configuration should look like the screen shot below



Build and Run


You should now be able to build and run the sample from the NetBeans tutorial.  Remember to make sure that your Qt Tool collection is the collection used for the build.

Wednesday, March 3, 2010

Varying interview questions

I wonder if interviews for other professions are as varied as the interviews for software engineers.  I guess with all the charlatans and pretenders out there, companies have been burned.

With the change in ownership at my company, I have been interviewing with different companies, and the questions have been varied and interesting.  I thought I would share some experiences with you.  Here are a sample of some of the questions I have been posed with.

  • How would you handle a situation where you were handed a deadline for some functionality and you KNEW it could not be done in that time frame?
  • What is the difference between deleting rows, dropping a table, and truncating a table (NOTE: This was for a Java developer job, not a DBA job)
  • How do you do String comparison?
  • What is the difference between a Map, a List, a Set, and an Object Array (You mean besides the fact that an Object Array is a primitive part of the language and the others are not?)
  • Describe how you would manage a software development project.
  • Describe a time when you had to debug something and the tools you use.
I believe I've done reasonably well in the interviews I've been in, but the questions to me seem to be all over the place.  Perhaps employers have a variety of needs and are trying to determine where I would best fit.  Either way, its difficult to be prepared for interviews.  Last week I was reciting intricacies of JVM memory reclamation, language features and syntax, and constructs. This week I was describing my use of requirements, Use-Cases, UML and Sequence Diagrams.  I can't wait to see what next week brings.