WPF is really awesome!

Today, I had the great experiance of leaving the office with a feeling of, “Oh my God, IT WORKS”!

First of all, dealing with a graphical user interface in Java can be a pain in the butt.  Let me first write up an example in code:

JFrame f = new JFrame()  //This is my window that I want to place everything in.
f.setBackgroundColor(Color.Blue); //This should work, right?  wrong!!!  

Even though the JFrame has a background color property and you think you should be able to do it this way, you actually cannot set the background color of the window in this way.  The proper code would be:

JFrame f = new JFrame();
f.getContentPane().setBackgroundColor(Color.Blue);

It is first necessary to get the pane where the content is going first before you can set the background property.  To the newbie in Swing, this is a nightmare.  You set a property that you think should have the desired effect, but you end up wasting a great deal of time searching for the correct object to set one specific property that you think should go quickly.  This is often not taken into account when coming up with time tables and figuring out how long a certain project should take to develop.  Of course if the developer is experienced and knows all of these crazy things, or of the newbie programmer has the best book on Java Swing (THANKS MOM!!!!) currently available, then that time can also be minimal.

My experience in WPF today was extremely favorable.  First off, I did not have 1 issue setting a property.  If the specific property was available to me, it did something when I changed it.  It may not have done what I thought it did, and I may have had to change a different property in another object, but it still did something.  I did not have to wonder what I did wrong, and in many cases the error messages that I got where enough to send me in the correct direction.  This above any other point leads me to the conclusion that I have been working with the wrong GUI for the past three years.  And if the GUI was wrong, then I am wondering if I am using the correct language.  For as much as C# can be confusing and not very intuitive, and for as much as I may not like having to look up the correct DLL file to import in order to reference the class I want, I must say that this alone is a reason to make a fundamental switch in regards to my preferred programming language.  One last thing I have to say, is that the GUI looks GREAT and I am horrible at front end design.  I mean horrible!

My goal for today was to create a front end where it would be possible for new apprentices to write there reports in a program installed on their local machines.  At the moment, they are all using a [Lotus] Notes database installed on a domino server.  Although this sort of setup is not wrong, and even safer than installing everything locally, it is still not optimal because they only use one or two Notes/Domino applications and they do not always want to start up the Notes Client ( a thirty second start on a really good day, two minutes on a normal day, and ten minutes on a bad day) just to make a quick one minute change to a document which tracks their weekly activities for the appropriate agency.  Let’s face it, none of us wants something like that.

Today, I started this front end.  My job is primarily to get myself situated with WPF development in the hopes to be a choice to help the development of a program for company X.  The form that I am basing this front end on is not really busy or anything, there is the typical data that needs to be stated, such as for which dates this particular document will be used for, names, departments, and a block where the user can input what they did that week.  It is really simple and that made it ideal for a first try.  Opening up the main window resembles a word document where the user sees a normal page sized white area in the center, and on the left is an area with tiles that can be pressed in order to open the document that should be opened.  This makes for everything to be pretty simple without much extras.  I do plan on extending this GUI to be able to use drag and drop functionality to open other documents and so on.  As I said, this is only phase 1.

Basically, I am so impressed because I could go into Visual Studio today with a basic idea of what I wanted to do today and without any issues at all, I could effectively design this program and come up with a great prototype to show the bosses at the end of the day and say, “This is what I could do in nine hours time with almost no foreknowledge! This is something that has been sorely lacking in the past year.

All of this being said, I am really contemplating starting BudgIt completely over again, and making a brand new Windows based application where I can truly make use of the great things that WPF has to offer.  Even if this does limit the “customer” base to those who have a windows machine, I do not see that as a big problem.  Every Linux user I know has at least one partition for Windows or at the very least a virtual machine with Windows installed.  The downside to this would be relearning everything the C# way, and a lot of stuff that I have done is very specialized. I would have to relearn encryption, IO, everything.  But, that is needed anyway eventually.

Point of the day: Thank you microsoft for actually doing something right and offering a quick and easy way to impress myself and co-workers by creating Windows GUIs using WPF!




About reederProgramming

I already have an about me page, so I will just put a quick bit of info here. I am a Notes/Domino developer at holistic-net GmbH located in Hannover, Germany. I use Java primarily at home and as often as I can at work. I have dabbled in C# and a few other languages and platforms. This website started out as a place for me to quickly store and access some of my most important how-tos and has started to become a place where I can really help others too!
Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *