Wednesday, May 28, 2008

Netbeans observations/complaints

I have been meaning to do a detailed writeup of my recent use of Netbeans and how I find that it compares with Eclipse, Intellij, and my admitedly limited use of Visual Studio .Net 2005 .... however I have a problem with big posts like that ... they never get done.

So instead, here are a few of my recent observations

  • Along with Elcipse ... given that these IDEs are free and have the quality they do is amazing.
  • The Netbeans community has produced tons of great walkthroughs and tutorials for how to get up and running with various technologies/languages using Netbeans. Granted most are understandably heavily dependent on using Netbeans, they are full of good general content as well. They are great at giving you a starting point for something new
  • The overall user experience is cleaner than Eclipse/IntelliJ for most things. However, this is somewhat due to it lacking features the other two have.
  • As a platform for learning Ruby coming from a Java background, its really nice. I love that it comes with Rub support built in with a lot of great features/tutorials/wizards/help. Also, the fact that it leverages JRuby out of the box so that its self contained and doesn't require a ruby installation is a credit to the people working on JRuby.
  • Netbeans lacks in the refactoring/editing department when compared to Eclipse and IntelliJ. Not horrible, but not nearly as good.
  • Built-in support and packaging with Tomcat 6 and Glassfish v2 servers plus its support for JEE 5 specs and tools is great
  • The projects view is a nice feature (compared to the files view) which gives you a more logical view of your project independent of where things are on the system ... however its not as customizable as IntelliJ's and I have had numerous re-indexing/refreshing issues where it didn't find new files for a while.
  • Netbeans indexes TONS of stuff when it starts up and when you add new files to its workspace ... which means normal work is faster than Eclipse is (or was in the past) but it takes longer than IntelliJ and seemingly reindexes lots of files that haven't changed since I installed them.
  • Netbeans has some really nice editors/wizards which include a graphical drag-and-drop interface for creating JSF pages (and Swing forms?).
  • Evidently there is a bug in Netbean's file search b/c yesterday I tried to case-sensatively search for a particular phrase in my project and the Netbeans file search found 4 results. However there were aprox 6 files with the text. To be fair, I don't know exactly what the problem was and when I did a similar search from Windows .. it found only 2 matches so I am not sure what was going on. But irregardless it should have found them all. (if you did a search in the editor I had open, which was to a file in the same project, it found 2 references in the file, but it wasn't in the results list)
Overall its a very nice IDE with growing support for different languages. Its free which is nicer than IntelliJ's not free and cleaner than Eclipse which is less and less an IDE and more a platform (for better or worse).

Friday, May 23, 2008

Problems and Solutions

Each of the following things has come to bite me in the back side over the past few days...

Ruby / Rails dates:
Since Ruby (and other languages like it) allows you to dynamically add new methods to classes after they are originally defines, AND everything is an object (including numbers) you can do things like these:

6.months
3.weeks.from_now
1.year.ago


which leads to easily read and understood code and is pretty clever. Only one problem .... there is a subtle nuance here that can be easily missed (as was by me the other day) that can lead to trouble (this same problem is inherant to many languages and DB's concept of time/dates) as is demonstrated by the following statements:

60.days == 2.months
60.days.ago != 2.months.ago


Some of you may pick up on the reason why this is true (and false) but given that I haven't worked in Ruby long and the implementation of the .months method apears to define it as self.days *30 lead me to some confusion.

The reason for the difference is a matter of context. Without the context of a particular point in real time, 2.months is really an abstract duration which the developers decided to define as 30 days / month. When you say .ago you are really saying Time.now - XXX which puts it into context of today and now months.ago means take today's day of the month and move the months number back 2. So as was the case the other day, 2.months.ago == 61.days.ago .... thus the problem.
NDoc
Recently I was documenting some C# code and my pair suggested we use a tool called NDoc which he had used in the past to produce nice Windows help files similar to JavaDocs ... great.

Only problem is that NDoc apears to only work with Visual Studio 2k3 and older ... and someone's port for 2005 has a few bugs. The first being that there is evidently a problem with some of the binaries which means you can only use it if you download the source and rebuild (not a big problem). The second was that it doesn't handle dependencies very well and won't know where to look for your referenced .dlls unless you explicitly tell it where to look for them. This wouldn't be too bad if the feature worked ... which it doesn't. Well, it DOES work if you know the special handshake. In this case the hand shake is to change the property saying to use fixe paths from false (default) to true. And then back again (false x2). Then everything magically works. Thank you random comments poster for this insight and thank you NDoc2005 for producing some decent documentation.
Google Maps API
The google maps api requires a key to be accessed, which can be generated for a given URL you want to use it on by their website. Simple enough, but I have had trouble when doing development work on other sites which didn't have the same key. Luckily I stumbled upon this yesterday. It says its the key for localhost and it works so I am not complaining. :)
SVN + Cygwin + SSH + Capistrano
This one was today. While trying to get our Rails app to be deployable via Capistrano, we decided it would be easier to work on it locally before bothering to set it up on one of our dev servers ... oh how we were wrong. Capistrano attempts to SSH to the server you are deploying to and export the latest code for your project with Subversion. One of the commands it tries to execute looks something like this:

svn update -s -r1234 https://svn.xxxxxx.com /www/apps/myproject/20050523042212/ && (echo 1234 /www/apps/myproject/20050523042212/RELEASE

Thats not quite it but its close enough. Basically via an SSH session it tries to export the latest revision to a new time stamped directory (creating it if necessary) and echoing out the version number to a file called RELEASE. Thats all fine and dandy if your server is running a *nix, but if you are trying to test it locally on a windows box and your SSH server is being run via Cygwin .. then your in for a world of hurt.

Basically, the path you passed into SVN ends up having its slashes switched and is mapped relative to the drive root while the other is mapped POSIX style relative to your Cygwin root which unless you went against the big warning box that pops up, is NOT the drive root. Thus it doesn't work.

I don't have a great solution to that one ... it was just a pain and caused me to lose 45 minutes of my life I will never get back. Tuesday we skip the local testing and get it working on the dev box which is Fedora Core.

Thursday, May 22, 2008

Long time update

A lot has gone on in my life during the 2 months between the last post and this ... but I won't go into it all. Basically, I started a new job that is a ton more exciting and which I love ... but which doesn't leave me with tons of free time during the day to surf the web and write up posts (which I am great full for). The only problem is that now I have much less time to post and much more interesting tech stuff to write about.

I am going to try and actually post semi-reguarially about the stuff I am doing at work and in my free time.

That being said .....

At work I am currently in a holding pattern on my primary project (waiting on the client). For the past several weeks we have been developing a pair of web service implementations and server code for a government contract to aid the National Sex Offender Public Registry. Its been some very interesting work:

  • learning more about web services
  • TDD+pairing every day
  • comparing our Java and .Net implementations
  • getting to work in .Net for the first time
  • writing our test harness code in Ruby
  • trying to code in C#, Java, and Ruby within the span of 5 minutes and having semi-colons in the right places
While we wait on some decisions by the client and find out what they think of our work so far, my pair and I are helping out another group update some internal application code written in Ruby on Rails. I did some very similar work my first couple weeks before the NSOPR project started up and its going well.

Other than work I am working on a small personal project related to word searching and an online game, bouncing ideas around and trying to help out the Brain Trust (you know who you are) and as of today trying out Google's AppEngine framework as I work through their tutorial and consider writing up an app to try and solve the problem we discussed here.

Wish me luck

Wednesday, March 19, 2008

Test Driven Development By Example - Kent Beck

After hearing about TDD and going through a class on TDD I was very eager to see what this book could offer. After finishing it this past week, I can honestly say it was a very good book ... but I still need experience more than anything.

The book is broken up into 3 main parts: 1) straightforward TDD example involving currency conversion code in Java, 2) a much more thought provoking example writing a xUnit testing framework from scratch in Python and using it to test itself, and 3) a large collection of "patterns" for development, design, testing, etc.

Overall I thought the book was very good and presented a lot of topics in a straight forward and engaging manor. The only problem I had with the book, really with the topic, is that it is hard to follow the examples without sitting with a person while they do it. Numerous times, if the author had been sitting with me as he types, I would have asked simple questions about what just happened, why we did something, or what some bit of code looked like from a few pages back ... all of which can and were answered in the book, but not without flipping many pages and trying to keep the whole code base straight in my head.

I especially enjoyed the example in Python since its a language I am currently trying to learn, and it showed some of the constructs that Python has to offer over other static languages like Java in an easy to digest manor.

All in all a definite recommended read .... although I can tell that experience is what is going to drive this particular skill (as is the case most of the time). I can follow along with the author's decisions and understand his logic for the most part ... but I don't feel confident I could or would come to the same ones given the chance.

Wednesday, March 12, 2008

IntelliJ IDEA Tips

This past week I found two new* features for working in IntelliJ .....

1) Shelves

IntelliJ 7.0 brings the idea of Shelves to its version control and local history features. Basically, by "shelving" local changes, IntelliJ gives you a nice interface to creating a patch for your current work and automatically rolls back the changes to the current VCS version. This makes it easy to experiment with some changes or begin working on something, stop and go back to a previous version to handle some other situation (like a bug fix) and then bring your local changes back. Normally I would just commit my changes to the VCS, but if I am only partially done and they are not complete, I might not want to.

In trying to learn a little bit more about this feature, I noticed a few entries on the interwebs about problems people were having with IntelliJ losing site of their patches or being unable to apply them back. In my limited practice I haven't had any problems and IntelliJ was able to easily add back my changes even when I had modified one of the files in the meantime.

2) Tomcat Plugin Debugging

In the past I have had limited success with application server plugins for Eclipse (they didn't always work, required strange configurations, had memory issues, etc) but they often claimed many great features also (ability to restart from with the IDE, automatic deployment of changes, monitoring, and DEBUGGING).

When I moved to my current employer and began working with IntelliJ instead of Eclipse, and no one I worked with used the built in plugins, I reverted back to the normal command line tools.

The other day we ran into a very strange bug in our development environment which we were able to duplicate locally, but unable to understand with the code's existing level of logging and lack of monitoring features. IntelliJ to the RESCUE!

After ~15 minutes of playing around, figuring out why my compiled classes didn't contain the right debug information, and spending some time trying to figure out where IntelliJ's version of Tomcat wrote it's log files ... I was up and running and able to fully debug my applications code while running it locally in Tomcat.

If anyone is interested in some of the steps I took to get it working, I have uploaded a copy of the quick documentation I created for work here. I wrote the page in word and foolishly saved it as HTML ... which produced tons of crap HTML full of Word specific tags .... luckily I found this tool which removes them. Funny how MS had to release a tool to removed stuff that their tool added in the first place (and probably no one ever used). Its also funny that their link to other advantages for using the tools is name: Use Office HTML Filter to Create Web Pages that Download Faster. Never mind, it only installs if you have Office 2000 installed and we have 2002. :-(

* new to me, which is sad on the second one.

Tuesday, March 4, 2008

Too many ideas, too little time

I feel like I haven't been able to work on any of my many tech-related projects lately ... or at the very least haven't been able to make much headway on any of them.

  • Project Spedini - on hold. this still interests me, but I was having to spend a lot of time trying to figure out how to interface with the UI as a human, and not on the part I really cared about ... the algorithms to decipher what was going on and predict what was happening next.
  • TDD project - I have been slowly working through a demo project for myself to try and get a little bit more experience in TDD and testing habits (since my current work doesn't use them) but this is going slowly.
  • Delicious Blogger Python Script - no real work on this since my last post :-(
  • AJAX Framework Testing - I did some initial work with Python but not much else b/c the use I had for it at work fizzled when we decided to solve the problem another way.
  • RoboCode - I have to thank some Cincinnati friends for this one. They are all trying their hand at creating some robot AI for the RoboCode environment and of course, I got interested and had to start one too. This is a really neat idea and a nice way to try things out and get some immediate results (having the whole graphical testbed and environment already written is the key). I have a very simple bot coded up .... which find it hard to hit another dummy bot that just drives in a circle ... but at least its a start. If anyone is interested in writing a bot or talking about ideas, let me know!
Like I said, too many ideas, too little time.

If the weather holds up,
I am planning to go to the Gateway JUG meeting tonight
for the Adobe Flex presentation ...
but its snowing pretty hard at the moment.

Friday, February 22, 2008

Random Web Links for 2008-02-22

Tuesday, February 19, 2008

A Proud Sun Certified Enterprise Architect

Today I found out that I passed parts II and III of the Sun Certified Enterprise Architect (JEE 5.0 edition) exam ... meaning that I am now fully SCEA certified! I have been waiting almost two months for the last parts to be graded and results sent out. Going into it, I didn't think I had a chance ... but after a lot of studying and a ton of time spent trying to figure out if I did the project portion correct .. I am proud to say I passed.

Do I feel any different now that I am a SCEA? Nope.
Am I glad that I got the certification? Yes.
Will I put it on my resume? Yes
Do I think this certification proves that I can do X, Y, or Z? No, but its a good start.
Do I think recruiters/hiring managers should use them as a hiring requirement? No.

Coming out of college I didn't know much. Period. I knew there were lots of professional certifications out there and that "I should have some" because ...... other people do. Working as a consultant right out of school, I was pushed to get at least one basic certification in either the .NET or Java side of things. Obviously I chose Java. This was done, primarily, so that the consulting company could put it in my profile for perspective clients ... as a way of proving I had some level of experience.

I don't fully agree with this.

I have come to the conclusion that certifications don't mean anything out of context. It should be understood that they only "prove" that I could do well on a test, the day I took the test. They don't prove I know "the stuff", they don't mean I will be a good employee, and they don't mean I will do well when I try and write software for you. They don't even get you the ladies (or at least the ladies who go for a guy wearing a SCJP pin, aren't the ladies I would be after).

So what are certifications good for?

Well, if you talk to a guy and he can explain why he got a particular certification, what he found difficult and easy about it, how he thinks it could be improved, and how he has related the stuff he learned to his day to day work (citing specific examples) ... thats a great thing. If you can talk about your experience in the area and how studying all the crazy edge-cases and unused syntax has helped you on a project ... way to go.

If not, its just proves you tested well.

I am proud of my certifications. I am proud of the time I spent studying for them and proud of the instances where I knew something another developer didn't that I learned while studying. I am even more proud of the crazy problems I couldn't solve despite being certified in the technology ... but remembered how to tackle the problem because of it. I am most proud because I got them without anyone bugging me to .... many notable leaders in the field will say that the majority of programmers don't read blogs, write pet programs, or constantly think about problems. They don't get certifications to force themselves to learn something beyond what they know today, just for themselves. I am most proud of the fact that I am not like that.

At least most of the time.

What are your thoughts/experiences with professional certifications?

Monday, February 18, 2008

My Computing Past

Scudder's recent post recounting his march from young computer nerd, to professional computer nerd, has inspired me to do the same. Here is an outline of my computing past: projects I remember, things that inspired me, languages I played around in ...

Early School Years

  • The first memory I can think of that involves me making a computer do something interesting, was in early grade school when we would go to the "computer lab" and drew pictures with LogoWriter. I loved making that crazy little turtle draw spin 'round and 'round, drawing lines all over those ~256 color screens. I didn't really have much of an idea of what I was doing, but man it was cool to send him off drawing with his little pen in a random direction, for some huge number units. Lines-galore!
  • At some point near the end of elementary school my dad showed me some very basic things in QuickBASIC and I was off (I am still trying to prove Dijkstra wrong). I can remember spending large amounts of time, trying to remember the few things he had taught me, trying my darnedest to create a password protection program. The thing didn't really protect anything in particular and I am sure the password was in the code in plain text .... but if you didn't type it perfectly the first time and/or do it in a short amount of time .... all hell would break loose. The program would start playing random musical notes and flash the screen bright colors until you hit Esc or Ctrl+Q.
High School
  • My freshman year of HS I took a class in BASIC. I learned a lot more during this class, with very little of it coming from the curriculum.
    • Most of my new knowledge came from working on a "large" casino simulation game that a few of my classmates and I cooked up. With BASIC's inherently simple graphics drawing capabilities (gotta love screen 12), some random code downloaded off the internet and a TON of hacking together, we actually ended up with a decent game. The first screen showed the outside of the casino including flashing neon lights. When you entered the casino you had to "walk" down a "3D" hall to get to the game rooms (this took me several days to figure out). I think we had simplified versions of poker, roulette, and some dice game. Not bad for a total n00b.
    • My second crowning achievement was a program which displayed zillions of ASCII characters to look like the BASIC editor. When you typed, the text showed up in the right window and if you hit Alt+F, etc ... the drop down menus popped up. However, the best part was when you hit "Run". At that point the program played some freaky random noise generator out the PC's internal speaker, showed a blank screen with a pulsing cursor and wouldn't let you do anything (unless you hit Ctrl+Break). The teacher thought it was hilarious and suggested I leave it running for the next class. Well, the next day I found out that the girl who sat in my seat next typed in a bit of her program for the day and tried to run it .... at which point the computer "freaked-out" and she began to cry b/c she thought she broke the machine. ;-) Blame the teacher, not me. :-)
  • UNetIt.com - To try and make a long story short, a HS friend of mine got it into his head that tons of money could be made if we could put together an online web directory of just programming tutorials, scripts, hosts, links, etc. www.UNetIt.com was the answer. The site was backed by some crazy VB-esque code, a horrible Access DB and ran on IIS .... but it worked. I spent countless hours surfing the web finding links to hosts, tutorials and scripts written in PHP, ASP, and JSP before I had any clue what they really did. The site actually was getting some decent traffic at the time and he was able to sell some banner adds to random companies netting us 10's of dollars!!!! While the site never really took off, given our experience it was a huge success. If you Google around for it you can still find some random broken links from back in its heyday.
  • AP Computer Science brought C++ into my sphere of knowledge. Granted it took me a few weeks to have any clue what all those #include lines were doing and it took me until college to fully realize that people didn't use APString in the real world ... but I learned a lot. I got a 5.
  • My senior year my parents didn't think I should take a study hall ... so instead I took a new class on VisualBasic which replaced my original one in BASIC. The teacher told me that he didn't want me bugging him about too many "advanced" questions since I already knew the stuff he was going to teach ... so he had me fill out the final exam in the first week and told me that if helped out the other kids and didn't bug him too much, I would get an A without doing any homework. :-D
College
  • Most of the early classes were taught with C++
  • We had to take a file manipulation and storage class that used COBOL
  • Reverend Thomas Schoen taught a very interesting class with C and Assembly
  • Numerous DB classes with SQL and PL/SQL
  • In a projects class on Genetic Algorithms and Evolutionary Computing, we wrote programs that tried to match facial photos by "evolving" better matching algorithms with Matlab.
  • Out later classes were mainly taught in Java including one where we wrote an assembler and virtual processor to handle a subset of some Motorola chip's instruction set.
  • Our research was mainly done in very naive Java using Aglets
  • I also did random web design work for on-campus jobs and FlyerWebDesign in HTML/JavaScript/Flash/PHP (neither contain my code anymore, thankfully).
Professional Career
  • The vast majority of my professional work experience has been on the JVM doing J2EE web applications and client applications in Java.
  • Lately I have taken an interesting in dynamic languages and have started playing around with Python and am intending to look more into Groovy and Ruby in the upcoming months.

Anyone else have some interesting old-school computing stories to tell? I re-found an interesting diagram of programming language time lines here.

Wednesday, February 13, 2008

Random Web Links for 2008-02-13

Monday, February 11, 2008

Shortcut Keys in Windows ...

... are frustrating.

Here a few things I learned today at work:

  • IntelliJ IDEA has a built in refactoring for creating a new constant from an expression mapped to Ctrl+Alt+C by default.
  • At some point prior to me using my current PC, another user installed Lotus Sametime Client and mapped its shortcut to Ctrl+Alt+C
  • When I try to run the refactoring in IntelliJ IDEA, Sametime starts instead.
  • Since I never user Sametime, I went to Add/Remove Programs and attempted to uninstall it. Despite acting like it uninstalled the program, it remains, shortcut key and all.
  • After some searching I finally found the renegade program on the disk and found that there was a custom program shortcut hidden away in Programs>Accessories>Communication which had the offending shortcut-key set.
  • After deleting the program files and the shortcut, I still couldn't call the refactor.
  • It turns out that if you delete a shortcut file (with a shortcut-key set), the binding doesn't get removed right away (presumably this happens at some other point, like when you restart or log-in)
  • The only way I have found to truly remove the binding is to create another shortcut with the same binding, change the binding to another key (or better yet, nothing), apply this change, and then delete the shortcut. This seems to effectively unbind the key.
  • Finally now I can use the shortcuts in the program I care about.

Seems a little limiting. All those restrictions, but no way to find out if it DOES conflict.

Despite a decent amount of searching I was unable to find anything on Google that helped the situation. I found plenty of sites showing me default Windows shortcut-key bindings, and several more posts from people frustrated with similar problems, but nothing to help. As far as I can tell, Windows doesn't have the ability to show you what key bindings are currently used and for what (this would be immensely helpful).

To be honest, I don't know how Mac OS X handles these situations but in my 1+ years of working on it I have never had the problem. I don't have this problem often in Windows, but have had it several times now.

I guess the real problem is one of scopes. There needs to be a clearly defined logic for how key-bindings get set/reset and how they cascade down scopes. If bindings are going to cascade into more specialized scopes, they need to have rules about what they can start with or something (e.g. have all Windows level ones start with the Windows key) and if something is allowed to be reset at a more specialized level, have only the closest scope take effect. It looks like Visual Studio does this along with other programs ... why not between programs and the OS.

Anyone run into similar problems? Or know of a way to see all of the bindings currently set?

Saturday, February 9, 2008

Gateway JUG - Feb 2008: Buildling DSLs

Despite the crazy weather and torrential downpour of rain, I was able to make it to the Gateway JUG meeting on Monday night. The talk wasn't what I was expecting and was very interesting. I knew the talk was on DSLs (Domain Specific Languages) but I was expecting the talk to be about how a developer can write applications that present DSLs to the end user, allowing them to describe business processes and what they want in a manor much more akin to their business training and actual representations. Neal, instead, focused on approaches developers can use to model DSLs and domain specific information in static and dynamic general purpose languages where the developer is the primary beneficiary. I liked his focus better.

The presentation outlined how we as developers can design our APIs and usage patterns in such a way that the code shifts from being a hodgepodge of declarative and imperative code, to primarily declarative. A coworker of mine pointed out that this can be done with good refactoring and encapsulation, which is true, but Neal's presentation took this even further. His examples started with business rules/processes that we needed to model in code, wrote the code in the way we wanted to express it (target syntax), and then modeled the API around that. The difference sounds subtle but resulted in code that expressed the true desire of the business rule with a minimum of extra syntax noise.

In doing so covered some good design patterns which he said were named after those that Martin Fowler is going to be using in an upcoming book he is working on all about DSL patterns. Also, he demonstrated how some of the syntactical and dynamic features of languages like Groovy and Rube allow DSLs to be composed much more fluently and expressively. The fact that you can boil down your code to something that looks like this in Groove/Ruby is pretty nice:

def recipe = new Recipe("Smoky Flour")
recipe.add 1.pound.of("Flour")
recipe.add 2.grams.of("Nutmeg")
assertThat 2, is(recipe.ingredients.size)
[chunk of code taken from Neal Ford's presentation, written in Groovy]
All in all I thought it was a great talk and gave me some ideas on how I can remodel my code to be much more exacting which will allow me to write the code to match the requirements a ton easier and allow me to test specific business rules without a ton of extra junk to get in the way of what I am really doing.

If none of that made sense, it may not have, check out the presentation here. The PDF handout for his presentation at CodeMash is the same as far as I can tell

Tuesday, February 5, 2008

JUG Tonight

Tonight I am planning on attending the Gatway JUG meeting where Neal Ford will be speaking on "Building DSLs in Static & Dynamic Languages". Sounds like a good talk and is on my way home from work :)

I had the pleasure of hearing Neal talk at NFJS in Cinci a couple of years back and am looking forward to tonight; especially since I don't think I will be able to make it to the STL NFJS in March.

This will be my second JUG meeting of the year, surpassing last year's total by 2 as well as my New Year's resolution of 1.

Random Web Links for 2008-02-05

Thursday, January 31, 2008

deliciousBlogger.py V1.0

As of late I have been spending some of my spare time (what little there is) on teaching myself Python. Honestly I haven't gotten very far, however, since I always find that the best way to learn something is to use it for a real purpose .... I submit to you the following first real attempt at Python

Need:

Easy way to post interesting links I find on the web to my blog without having to manually enter & copy them from Del.icio.us

Solution:

Python script that takes in the desired Delicious tag and usernames/passwords, retrieves link information from Delicious, creates simple HTML for blog post, and posts new post on Blogger blog. The 1.0 version of the script can be found here. It was written without a good idea of design (general or python) because my goal was to get it working, not make it perfect. Future changes will entail a better interface for doing more than one tag/blog at a time, moving the html template outside of the script, removing the delicious links or at least renaming their tags so that they don't end up sent twice, and some sort of error handling so that if the blog posting fails, I don't lose the links. Despite being some crappy to look at code, it works as can be seen by the previous post on this blog as well as recent ones on my other blogs.

Thoughts:

  • Since most of my work has been with Java, trying to not make it Java-esque is hard
  • I am still very much figuring out how to best use the dynamic features of the language and how best to "scope" things
  • There seem to be libraries out there to do anything you want, but without central places to look for them or consistent documentation, its hard to know whats available and what methods objects have (something similar to javadoc would rock)
  • The ElementTree documentation on this site is wrong for Python 2.5+, need to import ElementTree form xml.etree now, not elementtree
  • At the moment I have been working on my Mac with IDLE (came with the python version I installed) and it works well enough, but I need to find a better general purpose editor and/or find a good plugin for IntelliJ (great Java IDE and editor)
  • Some of the errors you can get by accidentally adding Java-esque syntax to your python script can be very hard to track down ;-)
Links:

Here are some more links I found helpful in writing this...

Random Web Links for 2008-01-31

Wednesday, January 30, 2008

Posted Comments

FYI ... I posted reply comments to several recent posts instead of a whole post devoted to them. If you have left me a comment, thank you, and check back on the post. Also, I have added an easy link to the site's comments feed which makes tracking them a ton easier ... I am going to try and reply when you comment, but it will take some time.

Tuesday, January 29, 2008

Car != Frying Pan

One of the first things you learn in software engineering is that duplication is bad and reuse is good. As generalized concepts applied to specific situations, both statements are true and are good ideas to keep in mind. However, if applied without discretion or thinking ... they can be worse than the alternative.

Let me paint a picture for you .....

You have a job. You buy a car to get you to work. You don't care exactly how every piece of your car works "under the hood" so long as it gets you to work.

You get married.

Your spouse wants to cook dinner. Neither of you owns a stove. When you get home from work, your spouse notices that the car's engine is very hot to the touch and immediately thinks: "stove = hot, hot = engine, therefore, stove = engine". Later that night you get a dinner that has been cooked on the top of the car engine. Why buy a stove when the car engine works (and the food isn't too terrible).

One day the car starts making funny noises and you take it to a shop. In order to fix the car, you need a new engine. The new engine has all the latest features including an engine that doesn't get hot to the touch.

Well, now your screwed. When you get home and your spouse tries to cook dinner on the car's engine, nothing cooks and you go to bed hungry and frustrated because you have to go buy a new stove now anyway (and you ate 5 years of meals tasting like motor oil for nothing).
I have run into this problem a lot lately (with the code base I am working on, not my car, Em is a good cook). The analogy is a bit crude and longer than I would have liked, but I think it demonstrates my point.

Without any formal testing in place, well defined components and ever changing feature changes ... the code is a mess of intermingled requirements and coding by coincidence. Large amounts of code have been reused b/c "reuse is good" and "code duplication is bad". Well the problem with this is that the real rule should be "reuse is good, when the component you are reusing is well defined and you are reusing it in the same manor as it was intended". Past developers have relied on reusing old components in new and unique ways (often by subsclassing, copying some long methods again while changing random lines in the middle, and ignoring others) which leaves the code base a mess. There is no order to the code. Components that started out as well defined thoughts have been bastardized into doing many things they were not designed for and without any documentation. Things are held together by random side-effects which only work b/c of random implementation specifics. If the specifics ever change, random new problems pop up.

Just because there exists a component that "could" do what you want "if you make certain changes" and if "you add undocumented desired behavior" ... doesn't mean you should.

If we are going to try and write code in an object oriented way ... we need to know the difference between the different types of object relations ships:
  • has-a
  • is-a
  • looks-like-a-from-across-the-room-but-up-close-isn't-a-and-never-was-a
  • mutant-asexually-spawned-offspring-of-a
... and which ones to avoid.

[this post is mostly to help me vent some of my frustration before trying to tackle the current task at hand again, thanks for listening]

Thursday, January 17, 2008

AJAX, Python and JavaScrip, Oh My!

@home, a year or so ago, I tried to play around with some AJAX stuff, but didn't get very far b/c rolling my own framework got complicated and there were too many choices getting press on the interwebs.
@home, I have been slowly trying to learn Python
@work, I need to validate some data against the DB via AJAX

---------------

So I decided to spend some time finding out about some of the leading AJAX frameworks and actually try and use a few of the best looking ones on the same task to see what each brought to the table. Also, since Java isn't the most "dynamic" language around when it comes to quickly prototyping stuff and trying to quickly change things .... I thought this also might be an interesting chance to do something "real" with Python.

Originally I was going to post my results and everything all in one post, but that was getting too long, so I will post each part separately instead.

---------------

Some of the criteria I want to look at when comparing the various frameworks includes:
  • size / # of files
  • other dependencies
  • documentation / community
  • ease of use / how much do I need to learn just to do the basics
  • usage style (collection of methods, objects, etc...)
  • JSON/XML/raw data support
  • cross browser compatibility
  • error handling (framework, transmission, application)
  • help managing/throttling simultaneous requests
  • help w/ continuous polling
  • extra features (user interface, DOM processing, etc)
My current tentative list of frameworks to look into includes:
The only requirements I have are that framework must be server-side independent. There are numerous ones out there that allow for easier integration with server-side components and/or generate the client-side javascript for you (e.g. GWT and DWR) .... but these won't work with my current work situation, so I am leaving them out ... for now.

Finally, here are some links that have been helpful to me so far:

If anyone has any suggestions of frameworks I have left off, ways to test them, or other sites I should check out, please let me know.

Wednesday, January 16, 2008

echo("wtf"); panic();

I guess it was bound to happen some day ....
It was only a matter of time I guess ...
Today my iMac BSODed.


Well not exactly. I guess (after a couple minute google and wikipedia search) that a better term would be that the UNIX kernel core of my iMac running Mac OS X Tiger decided to execute a kernel panic a few minutes ago. I was minding my own business doing some work with a few apps open (e.g. Firefox, iTerm, Transmission, etc) and went to open up Parallels Desktop b/c I wanted to check something in Quicken (Quicken for Windows came free with TurboTax last year). As Parallels was coming up, suddenly a gray overlay descended my screen top to bottom and a rather abrupt image was placed dead center ....


Mouse and keyboard didn't response and all I could do was turn off the machine (and yes, the irony of this happening when trying to open Parallels to run Windows XP on my Mac does not elude me).

I am not so naive to believe that Macs are without there problems, but this still surprised me. When researching Macs prior to getting my iMac about a year ago I read countless forums where people complained about this or that and the troubles they were having with there Macs. Macs are not perfect .... however .... they are MUCH more stable and userfriendly while doing the 90% of stuff you do everyday. Most of the errors people described were either attributed to hardware or were the result of the user trying to do something "outside the norm" and unable to get it right. This has been my experience as well. Normal stuff ----> works like a champ. Unusual stuff ---> works well and occasionally doesn't want to do what I asked, but is always polite about it.

This was the first time my Mac was ever mean to me.

Everything seems to be working fine now. I will post again if I have any future problems ... I just wish I new what the problem was. An Apple error report agent started when I rebooted and I sent in my memory dump info .... hopefully whatever strange little bug was executed is fixed in Leopard.

** the very observant among you may have noticed that this post was written in the middle of the day in the middle of the week ... when I should be at work. Well I didn't feel great yesterday/this morning and called in sick. Mystery solved. **