Ask a question
Friday, 16 July 2010 16:31
Introducing the Android Computing Platform
Personal computing continues to become more “personal” in that computers are becoming increasingly accessible anytime, anywhere. At the forefront of this advancement are handheld devices that are transforming into computing platforms. Mobile phones are no longer just for talking—they have been capable of carrying data and video for some time. More signifi-cantly, the mobile device is now becoming so capable of general-purpose computing that it’s destined to become the next PC. It is also anticipated that a number of manufacturers such as ASUS, HP, and Dell will be producing netbooks based on the Android OS. So the battle lines of operating systems, computing platforms, programming languages, and development frame-works are being shifted and reapplied to mobile devices.
We are also expecting a surge in mobile programming in the IT industry as more and more IT applications start to offer mobile counterparts. To help you profit from this trend, we’llshow you how to use Java to write programs for devices that run on Google’s Android Platform (http://code.google.com/android/), an open source platform for mobile development. We are excited about Android because it is an advanced platform that introduces a number of new paradigms in framework design. In this chapter, we’ll provide an…
Published in
Java
Tuesday, 15 September 2009 13:11
J2EE Design Pattern - Enterprise Concurrency
Enterprise Concurrency
The most dramatic difference between an enterprise system and a "regular" application is the number of users it must serve. As a result, enterprise applications face problems that don't often occur on the desktop. A word processor, for example, doesn't have to handle two users making changes to one paragraph at the same time—at the most, it might have to notify the second user that the document is already in use.
Of course, all data-centric applications, whether they serve one user or 10,000, need to concern themselves with the validity of their data. An action that seems simple to the user ("Order a book") may require complex, choreographed activities within the application ("Check inventory, reserve stock, charge credit cards, arrange shipping, etc."). The more operations an application performs, the more likely one of those activities will fail—and when it does, the system must be able to carry on. Providing for this capability is easy in standalone applications: just don't save your changes if the mail merge fails. But if other users have been modifying the same databases at the same time, the brute-force approach to data integrity won't pan out.
A lot of ink has been spilled on…
Published in
Java
Tuesday, 15 September 2009 10:51
Database and Data Patterns
Database and Data Patterns
Storage is the one constant in enterprise development. Enterprise systems are, essentially, information management systems. To the user, the value of these applications comes from the centralization of information resources, which allows broader access and more flexible interaction. Of course, you can maintain an entire information model in memory, but that's not the best method: if someone trips over the cord, your business is back to square one. So production applications implement persistence, storing information to reliable media.
This chapter focuses on patterns for implementing and optimizing persistent storage in the business tier. The first section introduces some basic patterns for accessing persistent resources: the Data Access Object (DAO) pattern and the Procedure Access Object (PAO) pattern.
The rest of the chapter focuses on solving recurring problems in database-backed applications. Since Java object graphs generally store relations between objects directly, we need to translate Java's direct object-to-object relationships into something that we can store in a database. The solution is a primary key: a unique identifier associated with each logical entity in the database, which can be used to represent the relationships between objects. Since unique primary keys are so important to the database side of…
Published in
Java
Tuesday, 15 September 2009 10:07
J2EE Design Pattern - Tier Communications
Tier Communications
This chapter focuses on managing the communications between tiers using data transfer patterns. Our goal is to provide a basic vocabulary for talking about exchanging data between different components of the business tier and between the business tier and the presentation tier. Ultimately, we want to be able to do this in a well-structured, efficient, and flexible way.
7.1 Data Transfer Patterns
In an ideal world, every time we send data from one place to another, we would include all the information required for the current activity, with no waste and no need for the recipient to come back with questions. Anyone who has worked technical support is familiar with the situation: it's much easier to have the user explain the entire problem at once, with all the relevant detail, rather than have to ask a series of questions to determine whether the computer is on, if an error message was displayed, if the software was actually installed, and so forth. A single support person can handle more problems with fewer headaches.
In Java terms, this ideal could involve transferring a single object containing a complete bug report, rather than transmitting several individual objects for each aspect…
Published in
Java
Tuesday, 15 September 2009 08:29
JEE Design Patterns - Presentation Scalability
5.1 Scalability and Bottlenecks
Before we jump into the patterns, let's take a minute to discuss what we mean by a scalable system. Think of a web-based system as a request processor. Requests come in from the clients, and the clients wait until results are generated. Everything in between—whether it's simply returning the contents of a static file or generating a fully dynamic page—is the actual processing.
For a request processor, scalability is related to the number of requests that can be processed simultaneously. In a simple sense, scalability might be the ability to "survive" a certain number of hits at the same time, eventually delivering a proper response to each one, but we know from experience that this is not really the case. If a news site gets 10,000 simultaneous hits and responds to each of them within 3 seconds, we might say the site scales adequately, if not exceptionally. But if the same site gets 100,000 simultaneous hits, responding to each one within three minutes would not be acceptable.[1]
For developers, acceptable scalability might be related to what's going on behind the scenes: a dynamic page won't be expected to return as quickly as a static page. Users…
Published in
Java
Monday, 14 September 2009 14:40
Java Enterprise Design
1.1 Design Patterns
A design pattern is a recurring solution to a recurring problem. From a programming perspective, a pattern provides a set of specific interactions that can be applied to generic objects to solve a known problem. Good patterns strike a balance between the size of the problem they solve and the specificity with which they address the problem.
The simplest patterns may be summed up in no more than a sentence or two. Using a database to store information for a web site is a pattern, albeit a fairly high-level and obvious one. More complex patterns require more explanation, perhaps including the use of modeling languages or a variety of other forms of longer description.
Design patterns originated outside the computer industry, originally showing up in conventional (as opposed to computer systems) architecture. Architects of buildings and architects of software have more in common than one might initially think. Both professions require attention to detail, and each practitioner will see their work collapse around them if they make too many mistakes.
The book to read, if you're interested in the architectural origins of design patterns, is A Pattern Language: Towns, Buildings, Construction by Christopher Alexander (Oxford University Press).…
Published in
Java
Monday, 14 September 2009 12:58
Agile - Spring Web MVC Framework
Benefits of the Spring Web MVC Framework
The Spring Web MVC Framework is a robust, flexible, and well-designed framework for rapidly developing web applications using the MVC design pattern. The benefits achieved from using this Spring module are similar to those you get from the rest of the Spring Framework. Let's review a few of these. I will demonstrate some of these benefits later in this chapter.
· Easier testing This is a common theme you will find across all the Spring classes. The fact that most of Spring's classes are designed as JavaBeans enables you to inject test data using the setter methods of these classes. Spring also provides mock classes to simulate Java HTTP objects (HttpServletRequest, for example), which makes unit testing of the web layer much simpler.
· Bind directly to business objects Spring MVC does not require your business (model) classes to extend any special classes; this enables you to reuse your business objects by binding them directly to the HTML forms fields. In fact, your controller classes are the only ones that are required to extend Spring classes (or implement a Spring controller interface).
· Clear separation of roles Spring MVC nicely separates the…
Published in
Java
Monday, 14 September 2009 12:02
Agile - Overview of Spring Framework
What Is Spring?
When people ask me what Spring does, I have to stop and think about how to answer it in one sentence, which is not easy to do as you will see shortly. So, let me first start by quoting an excerpt directly out of the Spring Framework Reference Documentation (springframework.org) because it describes the framework well:
"...Spring provides a light-weight solution for building enterprise-ready applications, while still supporting the possibility of using declarative transaction management, remote access to your logic using RMI or web services, mailing facilities and various options in persisting your data to a database. Spring provides an MVC framework, transparent ways of integrating AOP into your software and a well-structured exception hierarchy including automatic mapping from proprietary exception hierarchies.
Spring could potentially be a one-stop shop for all your enterprise applications, however, Spring is modular, allowing you to use parts of it, without having to bring in the rest..."
Let's explore the "modular" aspect of Spring a bit further. Figure 6.1 (also taken directly out of the Spring Framework Reference Documentation) is probably the best way to get an immediate understanding of the various things Spring can do, and it shows precisely why it…
Published in
Java