Who’s On Phirst

Official blog of Phurnace Software.

Tag >> java

Posted by: Shawn Spiars on

There are quite a few toolkits available for Java developers. Let me help point you in some directions and maybe save you some research time.

Many of you will be familiar with the Abstract Windows Toolkit (AWT) that is available with every Java Runtime Environment (JRE). AWT is the original Java GUI toolkit developed by Sun Microsystems. AWT is a peer-based toolkit meaning that each AWT control is dependent upon a host operating system control. AWT usage is limited because it was designed to only support controls which are available in all Java host environments. For example, AWT does not support Trees and Tables.

Swing is another Java GUI toolkit developed by Sun Microsystems and was designed to work with AWT and is built on top of AWT components. Unlike AWT, most Swing controls are emulated. This emulation makes user interfaces written in Swing portable across all operating systems and supports Sun’s “write-once, run anywhere” motto. One disadvantage to Swing is that the emulated controls often don’t result in a native looking application. Swing’s answer to this problem is provided by look-and-feel emulators that attempt to change the appearance and behavior of their components to adapt to a particular operation system or theme. Another disadvantage to Swing is that the emulated controls tend to run slower than peer-based controls.

The Standard Widget Toolkit (SWT) is another peer-based GUI toolkit. IBM designed SWT to solve some of the problems that have limited the usage of AWT. SWT provides a different Java implementation for each operating system platform using Java Native Interface (JNI) calls. One disadvantage for SWT is that developers are required to dispose of OS-dependent objects within their application code.

JFace is a GUI library that was developed to compliment SWT and simplify common GUI programming tasks. SWT and JFace libraries are used extensively throughout the Eclipse IDE.

As a Java user interface developer I have used each of these GUI libraries and I find the combination of SWT/JFace my favorite choice because of the native look-and-feel of the components. I also find the SWT and JFace APIs cleaner and easier to develop with than AWT and Swing. My two cents, comments welcome.

In Java GUI ToolkitsJava GUIjavaAbstract Windows Toolkit
Comment (0) Read More...


Posted by: Robert Reeves on

BBC has a news report on how boring tasks can lead to errors and omissions. Evidently, your brain will go into 'autopilot' mode when performing redundant, boring tasks. Apparently, there is a specific bit of brain activity that can occur right before you are about to make a mistake.

Your Brain on Phurnace

Until they can make a portable MRI for data centers that will catch that brain activity, may we suggest Phurnace Deliver to simply get rid of your dull and boring tasks along with your errors?

In Tipsphurnacejavadeliver
Comment (0) Read More...


Posted by: Shawn Spiars on

As a software engineer I often find it entertaining reading the technology job postings. You can learn a lot about a company's values and culture by what they reveal in their job postings. I once had a job interview with a VP of Engineering who was bragging to me during the interview about how much money he saved his company by sending half of his development positions offshore. So I am thinking to myself "if I take this job just how long until my position goes offshore"?

One of my biggest pet peeves is with the postings that say "Entry Level Programmer" and then go on to list detailed requirements that would take 10 to 15 years of experience to accumulate. This type of posting tells me that the company is really cheap and doesn't want to pay for the experience that is required for the position.

Then there are the companies that think they are doing you a big favor by allowing you to Join their world-class team because they are so much smarter than everyone else in the industry. They only hire engineers with advanced degrees and certifications and take great pride in Their superior intellect. A few years ago I had a short stint at one of these companies with "All Chiefs and no Indians". These folks were so smart that it took them over 2 years to get a software release out the door. They just kept arguing about how to do things better and better, and ended up rewriting the same Code over and over again until they ran out of money.

One of the things I like most about working at Phurnace is the "No Punks Allowed" philosophy as Robert likes to phrase it. "No Punks Allowed" basically means we look for people who are mature in how they perform their work and in how they relate to others. It also refers to the notion of egos in check, and a willingness to constructively share ideas and have ideas shared with you. After all it's the quality and character of the people that you work with that makes a job enjoyable or not. So, if you are a developer and you are trying to decide on your next gig, just remember - "No Punks Allowed."

Shawn

In java
Comment (1) Read More...


Posted by: Robert Reeves on

In the first part of this two part post, I discussed how scripts are terrible at eliminating errors. In fact, scripts simply replace typos with system errors. A rather poor trade-off, I think.

The second problem with scripts is the burden they place on employees to maintain them and the decrease in productivity they can cause. This maintenance burden and productivity sinkhole are the two areas scripts were supposed to fix!

Frankly, I hold the tools architecture responsible. Scripts conflate the Data with the Mechanism because of the enforced procedural nature of the tools (think wsadmin). Please note that I don't mean to pick on WebSphere, but I just have a *ton* of experience with that application server. I could have just easily singled out WebLogic, OAS, JBoss or Glassfish. The architecture problem is common to them all.

To see an example of conflation, navigate to your WAS 6.1 directory and look at samples\bin\PlantsByWebSphere\install.jacl. You will see the following:

  createJ2CResourceAdapter $nodeName $serverName

That's a good start as both resources are provided at the command line when executing the script. However, the script immediately falls apart on the next directive:

  #--------------------------------------------------------------------

  # Setup security cell

  #--------------------------------------------------------------------

  set secAuthAlias "$cellName/samples"

  set secDescript  "JAAS Alias for WebSphere Samples"

  set secUserID    "samples"

  set secPassword  "$samplepwName"

  createJAASAuthenticationAlias $cellName $secAuthAlias $secDescript $secUserID $secPassword

Don't see it the problem? I don't blame you. The problem is a hardcoded secUserId. This will fail if there is another JAASAuthData that uses the same secUserId as "samples". Now, that's a simple mistake; but it's one that will require a very specific use case to find it. So, we have actually created a maintenance headache for ourselves. This script may save me time in my Dev or QA environments. But, once it gets to Production where they use entirely different usernames for the database, I will have an error I simply cannot afford to have.

But, finding the specific JAASAuthData configuration problem is just the first headache. In my Production environment, imagine that this script fails on the duplicate secUserId value. Well, that's easy to fix, right. Let's just add another argument to pass in when the script is run.

So, I'm only into the second call of my script, and already I'm required to make the script more complicated. Furthermore, since my script is not wrapped in a transaction, I'll have to manually delete the J2CResourceAdapter to completely roll back. Or, at least, I *think* that's all I need to roll back my script's changes. After all, the best thing that can happen when I run a wsadmin script is nothing. Because if I see anything on STDOUT, that's normally a bad thing.

Ideally, I would have my Data described in a simple format that defines the System Resource (or MBean) I am trying to create and its associated attributes. Then, my script would read that data structure and create the MBeans necessary. Finally, at the end, it would generate a report that details what was changed in my environment. And, of course, if any failure's occur, all changes up to the failure are automatically rolled back.

Of course, I would love to see you purchase Phurnace Deliver which can do all of that and then some. However, you can create this yourself. The tools to do so are readily available and most Application Servers provide some sort of API to manage those configuration changes. Just remember to separate the Data from the Mechanism, and you should be much better off.

In Scriptsjava
Comment (0) Read More...


Posted by: Daniel Nelson on

If you have never been in the datacenter in the wee hours of the morning, trying to figure out what's wrong with a server, stop reading this.  If you have never been in an all-hands-on-deck meeting where everyone is trying to figure out what went wrong with a deployment, then stop right now and go do something more useful with your time.  Because if you haven't lived through that, then the rest of this post won't mean much to you.

I've been through plenty of those times.  And the truth is no matter what company I worked at - big, small, or something in between - we always had those times.  They are just a fact of life for people whose job it is to keep the server up and running.

Which brings me to the point of this entry (which is naughty blogging of me - you are supposed to make your point in the first paragraph, but oh well.  It's my blog, so I get to do what I want).  Anyhoo - the point is that so much is wrong with how we think about the "Software Development Lifecycle."  In all the flow charts and diagrams I've seen they all seem to be ignoring the very basic point that things go wrong.  And they don't have a lot of built-in mechanisms to help you through that phase of the life-cycle.  It's a black box in the flow chart that says "insert troubleshooting here."

Let me back up a bit.  If nothing changes about a server environment, chances are you aren't going to have a lot of problems.  Maybe a power supply goes out.  Maybe the network drops.  But for the most part you are only going to have problems when things change.  And that's the catch 22.  Things are supposed to change.  New code is supposed to go out to the servers.  New features are supposed to make it into the hands of eager customers.  And those changes are supposed to happen more often rather than less frequently.  That's how our companies compete with each other - it's called time to market.

And that's the fundamental disconnect between the two goals of keeping things up and running, and getting new code out faster.  As diplomat Henry Kissinger used to say, "real tragedy doesn't happen when right faces wrong, but rather when two rights face each other".  Keeping the servers up is a good thing.  Getting code out faster is a good thing.  How do you balance the two?

To me, any real Software Development Life-cycle has to fully embrace the fundamental belief that things are going to go wrong during any process.  Phurnace Software sells a product that helps do things better, but I can't claim, and I wouldn't claim, that if you use Phurnace to do your deployments that you will never have a problem again.  That's ludicrous, and simply not credible to people who have done this as long as I have.

But one thing that is very different about Phurnace, and the way we do things, is that what we have built is functionality that is designed to specifically help you out when things do go wrong.  We know it's going to happen at some point, and we work hard to try to make it as infrequent as humanly possible.  But it will happen.  And when it does, we have the built-in the features you will need to figure that part out.  Heck, we even have a product named Troubleshoot. 

So, when you are looking at how to balance that "time to market" with "keep the servers up", keep in mind that you have to have robust tools and process in place to fix the problem.   A black box just doesn't cut it.

In troubleshootTipsjava
Comment (0) Read More...


Posted by: Alexander Bibighaus on

 Apple's iPhone represents a revolutionary mobile platform that has attracted people of all sorts to download the SDK and take a look.  Today, it seems I search the internet for "iPhone" related information only to find hundreds of rants.  Most rants are either about the lack of Flash and/or Java support for the iPhone. Perhaps this is because the world is full of developers who know Java or Flash, but not Objective C?

After I perused the SDK, frankly, I was impressed.  I believe the iPhone combined with the SDK is a highly versatile  device with a level of programmability that makes you wonder about the limits of what can be achieved.

The multitude of rants did inspire me to ask the question:  "Why does Apple not support Java since most all mobile phones support Java ME?"  Sifting through the diatribes of opinions, I found an interesting older blog that talks about how Apple could, if they wanted, ship a software upgrade to enable Java. Sounds to me that Apple is hedging their bet by choosing a chip processor that supports embedded Java acceleration engine called Jazelle.

Until then, it is an exciting new platform that requires a steep learning curve. Learning is what we developers enjoy doing, right? 

In java
Comment (0) Read More...


Posted by: Robert Reeves on

Up until the release of Phurnace Deliver last year, there were two choices when it came to Java Application Server management: manual data entry or scripts. Typically, a company starts with manually entering configuration data via a web-based admin console. Then, either organically or via a concerted effort, the company will move to using scripts to manage the Application Server configuration and deploying binaries.

Companies begin this migration for two reasons. The first is to automate mistake prone tasks in order to avoid costly errors. Second, the company seeks to boost efficiency and increase employee and system productivity. While both of these motivators are valid, scripts simply fail to deliver on both of these hopes. In this blog entry, I'm going to discuss how scripting fails to deliver on error elimination. In fact, I will contend that scripts will cause the same, if not more, errors than using a manual approach.

When Exceptions Are the Rule...

Imagine that I was tasked with updating the Server heap size on a WebSphere Application Server; specifically, the heap size is currently 512MB and I need to change it to 1024MB. This is a rather simply task using the WAS Admin Console. However, if it turns out that I have 100 Servers to update, the task begins to become a bit more daunting. I'm certain that, around server 60, I'm going to make a mistake and type in "11024" instead of "1024". A Heap Size of 11 GB is not what Server number 60 needs! Thus, a script sounds like a good choice. And, it is.

Unfortunately, you will never run into this specific case. In reality, the Servers' heap size will all be different based on utilization and hardware requirements. In fact, only 78 of the 100 Servers need to be changed. And, of the 78, 42 need to be 1024MB and 24 need to be 768MB, etc. You can see how reality would make this a very complex task, even for scripts.

When exceptions become the rule, you better have good exception handling. Simply put, error handling in the scripting environments provided by AS vendors are terrible. Error handling is almost non-existent and the execution environments provide sparse responses when an error does occur. In fact, when an error occurs, you cannot be sure it is the script or the environment in which the script is run. Moreover, you are unable to distinguish between a network connectivity error or JNDI name conflict error within your script. Thus, you must rely on the user executing your script to determine the root cause of the error and take corrective action.

If that is the case, then there is really no reason to write a script in the first place. That time would have been better spent on educating the user about the AS change process or (shameless plug) purchased Phurnace Deliver.

"Works on my machine."

I have been working on Java Application Servers since Netscape Application Server 4.0. In all those ensuing years, I have yet to come across a company that had an identical environment for dev, test and production. Each stage differed by topology and naming conventions. For example, I would see 2-way clusters in dev and test and 4-way clusters in production. Moreover, you will find different Cell names, JDBC Urls, Usernames and Passwords in each environment.

And, unless all your environments are managed by a single person with OCD and insomnia, you will encounter Configuration Drift across those environments. These drifts will start in Test or Production. From Test, the drift can be started by a Developer making a change to the Test environment without logging a bug or updating the current script. ("Oh, that error? I forgot to add a new Datasource. Let me add that real quick..."). Thus, when the code moves to Production, you will see the same error caused by a missing Datasource. Drifts can start in Production when IT admins make well intentioned changes to their environments without those changes being pushed down to Test and Dev. Thus, Dev and QA are developing and testing against an invalid environment.

The end result is that you begin to have scripts that only work for specific environments and not a specific release. Thus, the results of your script are little better than a crap shoot when it comes time to update Production. And, since most Application Servers do not keep track of configuration changes internally, determining what is different between two environments is near impossible. If you can't determine the delta, then you can't fix the delta.

Thus, hopes for mistake eliminating and increase productivity become pipe dreams. And, the organization is no better off than with manual deployment than with scripts.

Admittedly, errors are a significant cause of productivity loss; especially errors found in production. However, there are other ways that scripts can cause productivity loss . In my next blog entry, I will discuss how scripts simply move tasks from one area to another in order to give the illusion of productivity enhancements.

In Scriptsjava
Comment (1) Read More...