Home > Articles > Programming > Java

Daily Java Tips from Steve Potts and Alex Pestrikov—Week of January 27, 2003

  • Print
  • + Share This
Make java part of your daily life — take some advice from Java 2 Unleashed authors Steve Potts and Alex Pestrikov.
Like this article? We recommend

Like this article? We recommend

Java Tip for Friday, January 31st, 2003

Using Java RMI For EJB Communication Means Flexibility

The Java RMI can be implemented over any communication protocol. The EJB specification requires every container vendor to support Java RMI over IIOP. This makes all EJB containers interoperable. In addition to RMI-IIOP, a vendor can implement any other communication protocol. Thus, using Java RMI for EJB communication makes them very flexible.

Java Tip for Thursday, January 30th, 2003

Making the Case for Using Enterprise JavaBeans

If your manager has not done it already, she certainly will one day ask why you are using EJBs in your project. At that point, you will have to come up with the right answers quickly and be as relevant as possible. Saying that EJBs are cool probably won't help you. For every technology in a commercial project, there must be strong business reasons to use that technology. That is why we want to go over some of the reasons for and against using EJBs.

The business reasons to use EJBs are

Industry approval—The whole industry supports EJBs as a part of J2EE. The EJB specification is being developed under the influence of the major players and is supported by a number of companies. This means that a lot of smart people are overseeing the technology to serve you better!

Fast time to market—EJBs have features that make a developer very productive. The technology is also very flexible in that an EJB can be easily adapted to new business rules. This means that an EJB can be reused or bought from somebody else. EJBs allow you to build good systems quickly.

Cost-effectiveness—Because there are a lot of EJB containers, a lot of competition exists between them, which means that you, as a customer, have a choice. You can buy an expensive EJB server or a cheap one (possibly free). What's even better, you can start with a cheap solution and grow to a more expensive one as your business grows. The EJB specification makes sure that all EJB containers provide the necessary level of portability.

There are also technical reasons to use EJBs that you can give to the technology leaders in your company:

Technical leadership—EJB is the specification that is based on the latest advances in object-oriented design—patterns and best practices. Your developers will design a robust system without much pain.

Maturity—The technology is the result of four years of hard work of many talented people. A number of projects are in production or coming to production in the near future. This means that the container vendors had time to fix initial bugs and improve usability. It also means that people have tried different features and know their way around the technology.

Advanced container services—The EJB specification requires container vendors to implement certain services that we will discuss. It means that your developers will not need to implement these services, but rather use the best container implementation. Such a system has a better chance to be robust and adaptable to changing business rules.

Java Tip for Wednesday, January 29th, 2003

Use a JSP Scriplet to Define Variables For a Specific Thread

Any variables created in JSP declarations are created only once and are shared among all threads running on this JSP. If you need a variable to only be defined for a specific thread instance, you should not declare them inside a JSP declaration, but inside a JSP Scriptlet instead. JSP declarations can be coded in XML style by using the following pattern: the declaration code

Java Tip for Tuesday, January 28th, 2003

Ease Your XML Learning Curve

XML may look and sound complicated, but it is ultimately just a way to describe systems of data in plain text. Although there are may alternatives, while you are learning XML, the simplest way to create an XML document is to type it in using a text editor such as Notepad or vi. This is a useful approach because it gives you time to think about each reserved character and its purpose. After you've mastered the basic concepts of XML, you may choose to begin using a more powerful XML editor.

Java Tip for Monday, January 27th, 2003

Implement a System as a Standalone Product Before Distributing It with RMI

All distributed object technologies are hard to debug because the system is divided into pieces that normally run in different JVM and often in different computers. Because of that, it is wise to create your applications in a standalone fashion. After they are debugged to your satisfaction, they can be divided into parts and distributed where they can meet the requirements that specified that the objects be remote from each other.

Be sure to check back each business day for a new java tip!

  • + Share This
  • 🔖 Save To Your Account