J2EE Design Patterns 130
J2EE Design Patterns | |
author | William Crawford and Jonathan Kaplan |
pages | 368 |
publisher | O'Reilly |
rating | 8/10 |
reviewer | Philip Jacob |
ISBN | 0596004273 |
summary | Detailed collection of patterns suitable for beginners or architects alike |
If you are working on frameworks, integration projects or system components, it is my belief that you'll almost certainly pick up some ideas from this book. J2EE Design Patterns is organized according to the different layers that you might find in a multi-tier architecture: presentation, business, database, messaging, and others. Consequently, if you're a JSP developer on a project team, youll be able to get some ideas for how to organize your work as well as how to interface it with, for example, controllers, if you're following an MVC framework. Or, if you're integrating various distributed non-Java systems, you'll want to read the chapters on Business Tier Interfaces and Enterprise Concurrency.
Judging by my friends' bookshelves, another popular Java patterns book is Core J2EE Patterns. If you already own this book, you will find that this new offering from O'Reilly doesn't contain as many patterns per se, but seems to go into a greater level of detail describing each pattern and supplementing it with more code samples. A nice feature of the O'Reilly book is that each pattern gets ample coverage in enough detail for you to understand the actual problem, the causes and -- equally importantly -- how to put a solution into place. Each pattern is described using some UML notation and code samples (Chapter 2 contains a UML primer).
One of the problems that I've encountered reading books on the subject is that some steer so deeply into abstraction that they become hard to understand. Others are so stylistically repetitive that trying to read them becomes mind numbing. Fortunately, neither problem surfaced during the time that I spent reading this book. The authors avoided the visual repetition of the traditional Problem / UML / Goal / Actors format that other books follow by moving this type of description into an appendix. That lets the body of the book flow more easily and also supplies the reader with a handy quick reference in the back pages.
Do I have any complaints? Well, this book certainly doesn't suffer from any fatal flaws. But it seems that an acknowledgement of the popularity of certain components could have been included. For example, while specific MVC frameworks, like the ubiquitous Struts, were mentioned, Object-Relational mappers were not; I read some of the chapters and winced at the code samples that manipulated SQL strings and felt grateful that I'm using the wonderful Hibernate O/R mapping engine. Of course, for various reasons, some readers won't be able to use tools like these, and a book about patterns has to maintain a certain level of abstraction in order to maintain any lasting credibility. But the section on Object-Relational Mapping doesnt even mention that a class of tools exists without the use of EJB CMP (Container Managed Persistence). Thats a real shame, because manually moving data from the object world to the relational world and vice versa is time-consuming and error-prone (and frequently unnecessary) work.
It's a good book, with 285 pages of text and 53 pages of appendices. I've owned it for four days, and I've already managed to steal some of these ideas for the projects I'm working on.
Philip Jacob works for Eyeglasses.com. You can purchase J2EE Design Patterns from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Here's a design pattern: (Score:3, Funny)
Re:Here's a design pattern: (Score:2)
Tom.
Still Not Real Clear on Design Patterns... (Score:1)
I have never heard that term before...
Re:Still Not Real Clear on Design Patterns... (Score:3, Informative)
Did that make sense? I haven't had enough caffeine today.
Re:Still Not Real Clear on Design Patterns... (Score:1)
take freeway exists. there's different freeway exiting implementation depending on the problem at hand. very high traffic, you'll see the four circles around the exit. lower traffic, and possibly just straight exit and entrance ramps w/out the loops.
Re:Still Not Real Clear on Design Patterns... (Score:2)
Joke Pattern with Humor Facade (Score:1)
On older freeway systems you got performance increases too from loop unrolling although todays freeway systems that is less and less of a concern because of new aggressive optimizing architects and civil engineer caching.
My comment has nothing to do with design patterns by the way - it's an implementation artifact of humor.
Re:Still Not Real Clear on Design Patterns... (Score:2, Interesting)
It's pretty interesting to see where some of these modern day architects got their ideas and that patterns occur i
Re:Still Not Real Clear on Design Patterns... (Score:2)
OOP Design patterns are the only patterns specific to OOP
Deisgn patterns were first developed by an architect named Christopher Alexander. In his book A Pattern Language he used them to help present common design problems and solutions to other architects. Patterns are as much as a best practices book as they are a communication tool.
Re:Still Not Real Clear on Design Patterns... (Score:2, Informative)
For example, the Gang of Four book (Design Patterns: Elements of Reusable Object-Oriented Software) has a ton of patterns that it discusses, and the language that it happense to use to illustrate the solutions to these "problems" is in SmallTalk... Not a lot of people were using Java in 1995, and I was still in grade 10 programming Pascal
For example, one of
Re:Still Not Real Clear on Design Patterns... (Score:5, Insightful)
Pattern can be a misleading word because it has too many meanings. You could interpret design pattern as commonalities in design or as a design template (like sewing involves working off of a pattern). It's closer to the first definition than the second.
Just don't follow a pattern that you don't understand exactly how works. You'll end up with more problem than solution. That's why I usually don't like pattern books. Unless you read them like you would a chess book and try to figure out how/why it's a mate-in-2, then you aren't going to get any real benefit from them. Chances are if you can understand how/why, then you didn't need the book to begin with. There's a slim chance that you'll run into a problem and have not used a more optimal solution because you didn't read one of these books, but I don't think it's all that great. Design patterns should be taught in school as exercises for the common problems they'll run into, not really a place to start when trying to solve a problem.
Re:Still Not Real Clear on Design Patterns... (Score:3, Insightful)
I beg to differ. Design patterns are not just about showing problems and solutions. They are also to help for a common vocabulary among the people who use them. Instead of me having to explain that I used a pool of small objects with intrinsic and extrinsic state to solve this problem I can just say Flyweight.
Design patterns should be taught in school as exercises for the common problems they'll run into, not real
Re:Still Not Real Clear on Design Patterns... (Score:4, Informative)
The first time you read a "patterns" book, you'll sit thinking "but that's obviously how you do it". The advantage is that the pattern books generally spell out *why* it's the best solution, and you can then apply that knowledge in other situations.
Personally, I found 'Design patterns' hard reading. The concepts weren't hard, but the prose was painful. 'Patterns in Java' (not to recommend it too much - I mentioned it in another post as well
Simon.
Re:Still Not Real Clear on Design Patterns... (Score:3, Informative)
Re:Still Not Real Clear on Design Patterns... (Score:2, Informative)
Re:Still Not Real Clear on Design Patterns... (Score:3, Informative)
When the Gang-Of-Four book Design Patterns first appeared, there was a lot of talk about it at OOPSLA that year. I'd been a lucky witness to the birth of the concept a year or tw
Re:Still Not Real Clear on Design Patterns... (Score:1)
Hmm, I have used this, but I always called it a wrapper.
That is it wraps around another more complex class (or classes) to provide an easier (and usually with pre-defined behaviour) interface.
Re:Still Not Real Clear on Design Patterns... (Score:2)
Re:Still Not Real Clear on Design Patterns... (Score:1)
Isn't that like "extending" the class?
Of course you must then instantiate the extended class to use it.
Facade pattern
Sigh....
I wish we as an industry could just STOP coming up with new names for the same old things.
Re:Still Not Real Clear on Design Patterns... (Score:2)
He already said not:
Re:Still Not Real Clear on Design Patterns... (Score:1)
If you are using the same method names to do the same functions, albet with added functionality, then in effect you ARE extending the class. Just not formally.
Moreover it could be argued that this adds to the memory footprint and to processing time, as the new class must be instantiated, then it in turn must instantiate the class it is a mimic for.
Re:Still Not Real Clear on Design Patterns... (Score:2)
From a pragmatic point of view, yes. I would prefer to say that the class has the same method signature. Note that, for example, an encapsulating class of this kind could not be used in the same place as an instance of a superclass of the wrapped class. So taking a simple example:
Re:Still Not Real Clear on Design Patterns... (Score:1)
Mine too
There are subtleties to this OO business....
Re:Still Not Real Clear on Design Patterns... (Score:1)
Remove "clearly defined." Sometimes moving from the problem to the pattern is not clear, but going from the pattern to the problem should be clear.
Change "algorithm" to "model."
Definitions from Google [google.ca]
Another useful patterns book (Score:3, Informative)
Simon
hear hear (Score:3, Interesting)
Most popular Java pattern (Score:3, Funny)
Maybe I'm getting old, but at one time we just wrote systems that worked without regard to what was in fashion at the time.
Scottie: Cap'n - I confluckulated and strutified the entity beans, and I'm given 'er all she's got!
Re:Most popular Java pattern (Score:2)
That's right, I'm accusing you of being a COMPUTER LANGUAGE BIGOT!
Can't we all just get along?!?!
Seriously, though. Patterns are nice to have for architects, and since they are 'reused' its easier for developers to "create" the ideas the architect develops.
And patterns have been around too long to be considered a 'fad' (things like Extreme Programming is what I'd argue is/was a 'fad').
If y
Re:Most popular Java pattern (Score:1)
That's right, I'm accusing you of being a COMPUTER LANGUAGE BIGOT!
Can't we all just get along?!?!
As always, a great way to kick off a long and meaningful friendship.
Re:Most popular Java pattern (Score:1)
Re:Most popular Java pattern (Score:2)
Maybe the original poster wasn't talking about patterns, but *Java* patterns. Patterns are generally supposed to be implementation independent. Personally, I would be much quicker to read a book called Distributed Architecture Patterns than J2EE patterns. In my mind all the patterns in the J2EE book should be subsets of the larger concepts presented in a Distributed Architecture book.
Re:Most popular Java pattern (Score:4, Insightful)
We just skipped the important debate about whether or not "architecture" is the right metaphor for most IT. Most IT involves systems that evolve, as such they are generally better served with a flat structure where multiple people have input on the design and direct responsibilities in regard to implementation.
The architect metaphor is from the construction industry. In construction, the architect is pretty much elevated one step above God. The metaphor demotes everyone else to the status of code monkey. While such social patterns might be needed in a packaged software environment, I think it is better for most companies to have a flatter political hierarchy where multiple people have input on design and have their own areas of responsibility.
Regardless, design patterns have a great deal to offer in flatter structures, as they give people greater ability to talk about design issues.
Re:Most popular Java pattern (Score:2)
In other words, don't roll your own when the hard work of others is out there and precisely documented for you to use. IMHO, this is part of the difference between a software-engineer and your run-of-the-mill coder.
Re:Most popular Java pattern (Score:1)
Yes, but a horse cart is far less complicated than a Porsche.
Re:Most popular Java pattern (Score:1)
Shhhhhhh! Fad-grabbing is the best jobs program we have right now. Companies pay us to rewrite programs/systems of paradigm X into paradigm X+1 because they fear that their competitors will jump past them using the latest buzzware that looks so shiney in the brochure. Rationality and jobs are not necessarily related.
Design Patterns... (Score:2, Insightful)
Re:Design Patterns... (Score:5, Informative)
As it relates to OOP, it is like understanding how a car works. If you can grasp how a car works, you can generally fix any type of car.
There are many different problems out there, but if you recognize the problem (as it fits to a particular design pattern), you can use a specific OOP design pattern as a model for a solution.
If you spend some time learning the patterns, you save a lot of time creating a solution when a familiar problem presents itself.
Re:Design Patterns... (Score:2, Funny)
Factory f = new Factory();
Any good programming language should be extensible to handle frequently recurring constructs. Java does not.
That's right, this is a LISP post. We have macros and a whole host of other things you don't, nyah nyah nyah.
Oh yea..LISP is dead. More like, "LISP is a dead end where programmers go to never return to their original language."
Re:Design Patterns... (Score:2)
LISP isn't dead -- it's just another language. Arguing what is the "best language" is retarded, because there is only a "best language" relative to a specific problem. LISP may be great for writing AI routines, but no one sane would use it to write a cross-platfo
Re:Design Patterns... (Score:1)
There are many things that just can't be done in java that require workarounds. Try using the + to add an integer to an Integer.
Try implementing
begin {
} commit {
} rollback {
}
to handle arbitrary code in each of the blocks. I can implement the equivalent in LISP in just a few lines. Java requires quite a bit more.
The most successful thing about java has been its hype
Re:Design Patterns... (Score:1, Troll)
That's pretty much BS. Considering I have been going through a Comp Sci Master's program only knew FORTRAN and C in passing when I started, I know that Java is much much more than hype and to say otherwise is fairly ignorant. I have subsequently learned C, C++, Perl, and PHP and Java is, by far, the best bang for your buck hands down. Cross-platform is only the tip of the iceburg. Handling sockets, connecting to databases of all kinds, web develo
Re:Design Patterns... (Score:1)
There is a small benefit that you can run your own server on your windows box and that code should (not necessarily will) run on your server. This gives me the luxury of being able to use my IDE, Weblogic, and Lotus Notes all on my own machine. I'm going to tab over to my IDE and back real qui
Re:Design Patterns... (Score:2)
No, they aren't. They're (elegance arguable) solved in the Java Standard Edition library.
I hate it when people tout Java because of its libraries. Give me a few weeks (and some cash for snacks) and I'll compile you a list of C++ libraries better and more extensive.
Re:Design Patterns... (Score:2)
I'm a big fan of C (especially, obviously, for Unix/Linux system programming) even though I don't nearly use it as much anymore, but C++ was just god-awful IMO. However, you've got to admit that C/
Re:Design Patterns... (Score:2)
You say Java is safer. I ask what if I add one of the many garbage collection libraries? One -or many- of the many smart pointer libraries? How about then?
Re:Design Patterns... (Score:3, Insightful)
Re:Design Patterns... (Score:1)
Re:Design Patterns... (Score:3, Funny)
>you're never going to be able to account for the wide varieties of situations that occur in the real world with one book full of templates.
Its a pattern, not a final soluton. Use it as a starting point/a headstart.
>Maybe someone can sell this point to me?
Number one reason I like patterns is because it gives me a warm feeling that someone already had to suffer through the same dammed problems as me.
Re:Design Patterns... (Score:2)
Re:Design Patterns... (Score:1)
Re:Buzzword alert!!! (Score:1)
"But sir, if the VP is such a VIP, shouldn't we keep his PC on the QT, 'cause if it leaks to the VC he could end up an MIA and then we'd all be put on the KP ASAP."
In other words (Score:2)
You make a strong point.
My personal favorite design pattern... (Score:4, Funny)
More like antipattern (Score:5, Interesting)
Re:More like antipattern (Score:1)
i see more the design patterns describing general stuff, and the anti patterns books describing lessons learned, and good (or bad) implementation practices.
Design Patterns are a Shared Language (Score:2)
Finally someone with an accurate description of what a design pattern actually is. In fact, that is ALL it is. I disagree that being able to identify patterns in your code saves time and effort though. And how does forcing patterns into your code help when, by definition, a design pattern is commonly occoring. Yes, you may have added new words to your vocabulary of programmer technobabble, but
Re:Design Patterns are a Shared Language (Score:5, Insightful)
Re:Design Patterns are a Shared Language (Score:2, Insightful)
You have it backwards: Identify the pattern and your code will fit around it (no forcing). Design patterns are not about code or patterns in code-- but about architecture. And they are regonized from the problem-- the solution is the design pattern. There is not a design pattern for every problem but for th
Re:Design Patterns are a Shared Language (Score:2)
Re:Design Patterns are a Shared Language (Score:3, Insightful)
Re:Design Patterns are a Shared Language (Score:2)
Well yes and no. A design pattern is commonly occuring in general industry. That doesn't mean that your particular branch will use it. So not only do you gain a simple language to talk about what you are doing, but you also get insight into things you could/should be doing, but instead are doing a much harder way not realizing it.
Recognizing patterns also helps in deisgn. You know you need to do something. By having a list of patterns you turn to the list to make sure you pick the right one, instead
Participating in a focus group on design patterns, (Score:3, Insightful)
The basic concept behind a design pattern is to reduce common tasks to a set of repeatable and clearly-defined models. These models are:
Most businesses find themselves using one of three different design patterns. Larger businesses tend to choose one that is more suitable for dealing with a larger amount of business, whereas smaller businesses may find a more cost- and time-effective solution in a cheaper pattern.
I haven't read this book, but it's likely it'll touch on these and other design patterns. As always, it comes down to choosing the pattern you're most comfortable with.
more reviews of this book (Score:3, Informative)
Definitions. (Score:2)
What's the difference between a Design Pattern and a template [reference.com]?
= 9J =
Re:Definitions. (Score:1)
Re:Definitions. (Score:2)
When you want to make a dress, you don't buy a template, you buy a pattern.
When you want spray paint letters onto a sign, you use a stencil, not a template.
When you're carving letters into stone, you use a template, not a pattern.
It's all about relevant language. If someone else had written a salient article, perhaps we'd be talking about design templates, and pattern template, instead of design patterns and the template pattern.
Rega
Re:Definitions. (Score:2, Informative)
A template you fill in. This assumes that someone has already solved your exact problem, and you just need to add the details specific to this particular incarnation of the problem.
Design patterns are programming concepts that you can assemble to solve your problem. They are reusable in the sense that the problems that patterns solve come up often enough that knowing when and how to use them becomes important.
Design patterns also encapsu
More J2EE patterns (Score:4, Informative)
Core J2EE Patterns is another book on the subject. You can even find many (all?) of the patterns from the book online [sun.com].
I've found a lot of these patterns to be useful in other domains (PHP webapps) as well.
Is the Design Patterns book insane ? (Score:1)
Re:Is the Design Patterns book insane ? (Score:2)
Just you.
Too cold a definition (Score:1, Informative)
But, in this book, a pattern is not -just- a commonly accepted solution. It's a solution that's really good, really works incredibly well, and feels like a fundamental thing. It's a solution whose insight leaves a lasting impression on you.
This is where the software design patterns people rather missed the point, and the razzing they get from older engineers is well-deserved.
"IForone" pattern (Score:1)
Re:"IForone" pattern (Score:4, Funny)
That should read "I, for one, welcome our Singleton.getInstance() overlord"
Sorry, couldn't resist
Re:"IForone" pattern (Score:1)
ISingleton.getInstance().welcome("overlord");
Re:"IForone" pattern (Score:4, Funny)
Re:"IForone" pattern (Score:1)
Now that was funny.
Didn't we just have such a review? (Score:5, Interesting)
Like I sort of said that time, the design patterns are mostly just workarounds for a bad system. My advice is 'use JDO' and avoid all these problems (this is coming from someone working on both a JDO and a J2EE system right now).
I do in fact have one such EJB design patterns book, and its crazy the lengths they go to to make a broken system work
- Its too costly to make calls to an EJB's individual get methods - make a value object for each EJB!
- Don't like making all these extra objects, and coping with the extra maintenance required, and writing all the methods to transfer values between the EJBs and these objects? Transfer the information using a hashmap!
- Don't like the loss of all the advantages of using OO programming languages and entity beans instead of SQL which comes from passing everything with hashmaps? etc etc
Enough to make any experienced _object oriented_ programmer pull their hair out. Of course, if you prefer using the buzzwords of 'EJB design patterns' to the practicality of JDO then go ahead, code an EJB application - enjoy developing in an environment where the deployment required to test any changes is 5 minutes plus for any decent sized EJB project, where your $10,000s EJB server can't work out how to handle basic relations in the right order, and where you have to code half of your queries in SQL anyway (i.e. see the 'Data Access Command beans' pattern which the book no doubt has) as the system is so slow and not powerful enough.
Re:Didn't we just have such a review? (Score:1, Insightful)
Re:Didn't we just have such a review? (Score:1)
Here comes the flame bait, but ... (Score:1)
But they are not the end-all-be-all-panacea that some developers (and managers) imagine them to be. I have witnessed the following more than once, and it scares the hell out of me:
Oh, the proxy manager pool pattern in my framework does not have a helper. Perhaps a
Design Patterns Explained (Score:2)
How about web Services... (Score:1)
Maybe one can define all the patterns on a few basic patterns -- caller, callee, data store. In addition to GoF, "The Pattern Almanac" was the
Simple Definition - Simple Thoughts (Score:1)
no mention of Alexander? (Score:2)
when the enevitable book,discussion, etc on patterns and their use in software I remind myself of Christopher Alexander [utsa.edu] , Austrian born, Cambridge [cam.ac.uk] educated maths and architecture graduate.
One aspect of Alexanders work often overlooked, is that we should be making up your own patterns. Instead we look to references as cook books rather than as building blocks [patternlanguage.com].
Re:Oh, what a nice pattern (Score:2)
Regards
Re:Oh, what a nice pattern (Score:1)
He's was involved in an MRI R&D project and was frustrated by the techies/engineers/scientists who insisted on using obscure slang without bothering to translate it. You know, the classical RTFM attitude of an elitist geek.
Over here they teach the MDs to deal with young and old people, people with low/high IQ, people with good/bad literacy and so on. In short, they teach social skills. In my mind, this should be made compulsory i
Re:Design Patterns For Beginners (Score:2)
Every one has written an XML toolkit, File toolkit, JSP toolkit, Swing toolkit, etc.. The Java SDK is a 'tookit' itself. This does not eliminate the need for design patterns. In reality, software is designe