JSF and Annotations
Recently at work, we looked, ever so briefly, at a new web framework called Stripes. It looked rather cool, as it was largely annotation-based, but, given its glaring lack of any wide-spread usage, we never seriously considered it. Today, I was on The Server Side (you do read TSS, right? 😉 and noticed that Struts has released a Java 5 addon. One of the additions is annotation support whose only problem appears to be that it’s tied to Struts (that’s a joke ;).
At any rate, all of this annotation on the web tier got me to thinking (again) about my favorite Java web tier technology, JSF. The only “real” complaint I have with the framework is the XML, minimal as it is (I’m past the JSF learning curve, so I don’t have a problem with that anymore :). Being a big fan of annotations and IoC, I’ve been wondering if/when JSF will finally support configuration via annotations. Until this morning, I’ve just assumed that I won’t see that support until 2.0, but a thought occured to me: why can’t it be bolted on to 1.x?
In the interest of full disclosure, I’ve never written my own annotations, and I’m not too terribly familiar with the internals of either major JSF implementation, but I have in my mind a back-of-a-napkin sketch of a possible solution. My initial guess is that it might be possible to write a class (a FacesServlet child, maybe) that scans the classpath (optionally restricted by context-params, for example) looking for annotated classes and methods. Armed with the knowledge gleaned from the scan, we would then be able to build the context (I’m hoping) in a similar fashion to parsing faces-config.xml.
Is it doable? Am I off my rocker? I don’t know. Hopefully, I’ll have a chance to find out soon, assuming someone in the know doesn’t disabuse of the notion before I get started. 🙂
Losing Face(s)?
I’m a bit torn at work. I’ve long described our shop as a JSF, Spring, and Hibernate shop, a designation with which I am perfectly happy. Last week, however, after pointing my boss to a blog entry by a someone I “know” (I quote that, because he’s someone I talk to on IRC ;), I have been asked to investigate a framework called Wicket that could supplant JSF in our stack. While I’m not opposed to learning Wicket (so far, it’s been pretty cool), I’m just a little leary/weary of the technology treadmill, where we constantly reevaluate our technology choices. While a certain amount of that is healthy, too much of it paralyzes your organization, and, personally, I’m a little burned out on research and ready to get some actual work done.
Having said all of that, as cool as Wicket is, my inclination is to stay with JSF. For all the wailing and gnashing of teeth I’ve seen about how “hard” JSF is, and that you can’t do it without good tool support, I’ve not had much problem with it. It’s certainly not easy, but it’s a far cry from the impossible mountain to scale that some make it out to be. It does have its warts, to be sure, but I like it, and it works well for us. Add to that the momentum JSF seems to be building (especially when compared to other frameworks) makes me more hesitant to drop. It is a truism that popularity doesn’t make something better, but, in this case, JSF works for us, and I don’t want to adopt something that 1% of the rest of the world is using. Technical superiority (assuming Wicket has it) is meaningless if no one knows how to use the tool.
Now, to be fair to Wicket, I’ve been playing with it for just a few days. I like it well enough (despite the problems I’m having with Spring and Hibernate with it, which are my problems and not Wicket’s), but I’m not sure I have the energy or desire to dig much deeper into it. I’d really like to get some real work done, so Wicket may lose out to practicality. Time will tell.
How I spent the better part of an hour
At work, I’m trying to learn how to use Acegi Security, a security framework for Java web applications. I was using this tutorial, which was written for version 0.8.3, whereas I had installed 1.0.0RC2. Here’s the process I went through to update the code to use the newest version of Acegi Security:
- start container
- watch it crash
- kill container
- fix config
- start container
- watch it crash
- dig through docs to see what I missed
- make fix
- restart container
- watch it crash
- repeat ad nauseum
But it’s working now, and that makes me happy. 🙂
I have turned in my notice…
Well, I finally did it. Last Thursday, I gave my notice to Hobby Lobby. As one might expect, my boss wasn’t too excited about it, but he said he wasn’t too surprised. He’s known that I’ve not been too happy for a while. Part of my discontent was the adoption of .Net. The rest (and maybe the majority) was the installation of Peoplesoft Enterprise 1 (also known as PSE1, JD Edwards One World 8.9, and probably something else as soon as Oracle finished its acquisition of Peoplesoft).
Hobby Lobby made both of these decisions, as it felt that they were the best decisions for the company, which I can understand. Obviously, I disagree with the selection of .Net as the development platform. Peoplesoft, though, I supported and recommended (though it’s not like the whole decision hinged my opinion. They did, though, ask for it, so I gave it). I was led to believe by the salesmen, though, that we would interact with the system, as developers, via a Java API. However, as one might expect from salesmen, that picture wasn’t quite accurate. Not only will we not be using the API, there is no API. All interaction is done by reading from or writing to "Z" files and running programs. Not that the absence of a Java API would matter, though, as we won’t be using Java.
I spent some time doing development in both environments to see if I could enjoy my job. To be honest, though I am opposed to .Net for reasons I’ve discussed elsewhere, I could probably be happy enough doing C#. PSE1 development, however is a bunch of click here, double click there, type in a variable name on this line, drag this over here. Ick. The only way to see everything the program is doing is to print the "code." I just did not enjoy that (beyond learning it. Once the new wore off…)
So, I’m off to another company here in the metro. It’s a bittersweet decision. I’ve made some good friends here at Hobby Lobby over the past 3 1/2 years. It will be hard to say good-bye to them (though I’ll only be a few miles away from them and I go to church one of them). I wasn’t enjoying myself though, and that made me miserable at work, and the quality of my work suffered. That’s not good for them or me, so it’s probably best for everyone that I move on. Only time can tell if I’ve made the right choice. Right now, it feels right, and I expect that it will be…
Microsoft .Net Is Bad for Your Enterprise
Microsoft’s .Net is quickly becoming, if it is not already, the dominant development tool, for lack of a better word, for the Windows platform. For the uninitiated, "Microsoft® .NET is a set of software technologies for connecting information, people, systems, and devices. This new generation of technology is based on Web services-small building-block applications that can connect to each other as well as to other, larger applications over the Internet." It is MS’s answer to Java. Where Java has byte code, .Net has Intermediate Language. Where Java has a JVM (Java Virtual Machine), .Net has the CLR (common language runtime). There are numerous organizations migrating to .Net, some even from the Java world. But is this a good choice? On the surface, you gain a good degree of security from the built-in garbage collection and memory management, reusable components that will reduce the amount of coding necessary for a given project, and a great development tool. But are these pluses worth it? I would posit that they are not.
Those of you who know me know where I currently work. In order to avoid associating them with ideas with which they may not agree, I won’t name them. Instead, we’ll say I work for Widgets, Inc. Here at Widgets, we rely heavily on IBM’s iSeries machines. We have a plethora of legacy RPG code and seemingly innumerable files, tables, spool files, CLs, and so on. Fifteen or twenty years ago, the decision was made to run the enterprise of the iSeries (then known as the AS/400). At the time, the dominant language on the iSeries was RPG (for reasons that I don’t know), so all of the custom coding was RPG code. At the time, it made perfect sense.
Let’s fast forward, now, to 2002. RPG programmers are hard to find, and can tend to be expensive. That being so, the management of Widgets, Inc. decide to do all new coding in Java instead of .Net. This gave us access to modern technologies, and hordes of developers. A year and a half later, though, after some small- to medium-sized projects, we reversed our decision because user interfaces are easier in .Net. Choosing ease of development (an edge that Java will soon remove with JavaServer Faces), we have set the ball in motion for RPG, episode two.
How, one might ask, does .Net compare to RPG? For the longest time, companies making investments in iSeries and RPG-based technologies could rest assured that they were making a wise investment, one that would continue to make business sense for a long time. Over the years, however, the iSeries began to decline in popularity (for a variety of reasons I won’t cover here). As it became more expensive, in terms of developers and long term risk, to invest in the iSeries, companies moved more and more to other technologies, such as Windows. This made the iSeries less attractive to others, and so the cycle repeats. Now, those companies, such as Widgets, Inc. that have a substantial investment in the iSeries, have hardware and software that is becoming increasingly difficult to maintain. Among their options are to maintain where they are and hope for the best, which is probably suicidal, or migrate to another platform, a path fraught with new bugs and lost opportunities, but probably one of the wisest options.
Now, let’s fast forward fifteen to twenty years in the future. While Windows is the dominant desktop operating system in 2004, while also holding a respectable position (in terms of numbers) in the server market, no one can know what 2019 will look like. With Microsoft under increasing pressure from rivals such as Linux and MacOS X (don’t laugh, more and more people are turning to Apple), that dominance can not be assumed to run ad infinitum (anyone remember the once proud and invincible big blue of the 60’s, 70’s and 80’s?). In fifteen years, we very well may find ourselves running systems predominantly based on Linux, or maybe even some other OS that currently exists only in some company’s R&D labs. Should that day come (and I feel it will. It’s just a matter of when), what are we to do with all of this .Net code?
Those on top of the .Net "community" will probably be quick to point out the Mono project or DotGNU, claiming that a cross platform .Net is on its way. To that, I would point to this article that talks about how Microsoft is patenting their Office XML file formats, so that they can restrict who and can do what with Office files. MS is patenting something that is standards-based as part of the business-as-normal process of blocking competition. Time will most likely show the heavy hammer of the Microsoft legal department falling on the efforts to the Mono and DotGNU groups as well. Even if that never happens, as long as Microsoft is not actively helping to port .Net to other platforms, these porting efforts will always lag behind the official product.
So where does that leave us? A whole bunch of nice, modular, object-oriented, garbage-collected code that runs on only one platform, but at least GUIs are easier to write. Every language has its problems. While there are things that are easier in .Net than Java, the inverse is also true. All that being said, though, if the decision to use .Net over Java is simply because UIs are easier, then the decision making process was extremely short-sighted. In fact, in my mind, it’s not really even a .Net vs. Java question. It’s a question of portability. Given the speed of modern languages and systems and what we’ve learned over the past 40+ years in this industry, there’s no reason why we should let any vendor tie us to their platform, whether that vendor is Microsoft, Sun, Apple, or Red Hat. With regards to .Net vs. Java, since their capabilities are so similar and run time benchmarks show that they run about as fast as each other, there must be something to tip the scales. If you ask me, IT managers should lean toward platform independence, and leave their enterprise room to maneuver should its vendor of choice start making decisions adverse to the enterprise’s goals and capabilities. If you’re not tied to your vendor’s platform, you can’t be strong armed into making decisions you don’t want to make. With .Net, though, you’re tying your own hands.
When Will We Learn?
I will never understand why people still install Windows. Home users have a little more sympathy from me, but I have zero sympathy for corporations that still use Windows. I don’t want to come across as an anything-but-microsoft guy, because I’m not, necessarily. I am, however, a big believer in the best tool for the job, and, for most things, Microsoft is not the best of breed.
Need an office suite? Many will tell you that Microsoft has reached ne plus ultra, but I think they’re confusing perfection with familiarity. There are several good alternatives available. Most are even cross–platform. OpenOffice.org is probably my favorite (due to familiarity 😉 as it is cross-platform, and reads MS Office formats reasonably well.
How about a web browser? Many use and swear by IE, but I’d be willing to wager they use it because it comes installed on every machine they buy. My problem with IE is its inherent insecurity and its poor support for web standards. If you’re into ad-supported/commercial browsers, there’s Opera. My personal favorite is Mozilla. It has a fast, secure, standards-compliant browser, and a virus-free email program with great junk mail controls.
Need a database server? You can have your pick.
Email servers? Plenty to choose from.
Web server? While there are many choices, the stand out best is Apache.
How about the operating system? Lots of choices here too.
And for those alternative operating systems, need a virus checker? You can find them…well…maybe over here…nope. You don’t need them! These OSes are not prone to viral infections. That’s not to say that it can’t or won’t happen, but it is orders of magnitude more difficult to write a virus for these systems due to their inherent, multi-user, segregated role model of operation.
Would a migration to Microsoft alternatives be easy? That depends on the sophistication of the user and, for companies, the size of the organization. Is it worth it? Ask Ernie Ball.