Jump to ratings and reviews
Rate this book

A Little Java, A Few Patterns

Rate this book
Java is a new object-oriented programming language that was developed by Sun Microsystems for programming the Internet and intelligent appliances. In a very short time it has become one of the most widely used programming languages for education as well as commercial applications. Design patterns, which have moved object-oriented programming to a new level, provide programmers with a language to communicate with others about their designs. As a result, programs become more readable, more reusable, and more easily extensible. In this book, Matthias Felleisen and Daniel Friedman use a small subset of Java to introduce pattern-directed program design. With their usual clarity and flair, they gently guide readers through the fundamentals of object-oriented programming and pattern-based design. Readers new to programming, as well as those with some background, will enjoy their learning experience as they work their way through Felleisen and Friedman's dialogue.

200 pages, Paperback

First published December 19, 1997

6 people are currently reading
209 people want to read

About the author

Matthias Felleisen

13 books28 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
23 (31%)
4 stars
18 (25%)
3 stars
24 (33%)
2 stars
6 (8%)
1 star
1 (1%)
Displaying 1 - 11 of 11 reviews
Profile Image for Stefan Kanev.
125 reviews235 followers
June 2, 2013
I liked The Little Schemer, so I decided to give this a try. It was not worth it. It is fine that the book has nothing to do with real world Java, but it does a poor job of explaining too few patterns in a awkward style. While it was extremely cute in the Scheme books of the series, but it just does not work here.

Furthermore the code shown is so far removed from what Java code looks like, that it will take you a while to get it.

Probably the only thing worth it is list of recommended books at the end. Or at least, a part of it.
Profile Image for Kristofer Dubbels.
22 reviews5 followers
Read
March 26, 2021
Unlike The Little Schemer and The Little MLer, this one was an exceptionally tough read. Whereas Schemer and MLer use code examples that can largely be typed straight into a REPL and executed as is, this one requires quite a bit of work to get the pseudo-code examples up and running. In the abstract, this doesn't sound so bad - the pseudocode itself should be an abstraction of a programming language. It is intended to be *easier* to read, to facilitate understanding. However - and this is the key point I guess - it seems odd to specifically reference Java in the title, but then use what I would call "pseudocode with Java characteristics." This seems to me to be symptomatic of a basic issue with this volume: a confusion about what exactly it is fundamentally trying to convey. Is this a book about Java? A book about OOP? A book about patterns? (It is likewise interesting to contrast the books recommended at the end of A Little Java, a Few Patterns with the recommended books at the close of The Little Schemer. The Little Schemer recommends Alice in Wonderland, a book about Godel, a logic textbook, etc. The reading list that conclude A Little Java, a Few Patterns is... a few books about the Java spec and the Gang of Four book. YMMV but draw from that what you will.)

Which leads to the larger and maybe *the* fundamental issue with the book. Both The Little Schemer and The Little MLer each have effectively one "big" idea that is conveyed by approaching several smaller ideas chapter by chapter. So, whereas The Little Schemer is ultimately a book about recursion that covers quite a few topics through the lens of recursive thinking, A Little Java, a Few Patterns is.... a book about the Visitor pattern?

Now, having said that this book won't teach you much about Java and will teach you one one design pattern, I'm going to recommend reading it anyway. Whereas The Little Schemer and (to a lesser extent) The Little MLer were both joys to read (and re-read!), this one was a tough slog. Now, all that said, I'd still recommend this book to anyone who enjoyed the companion books. The Visitor Pattern gets all of 2 pages in the Freeman and Robson book on Design Patterns and just shy of 15 pages in the Gang of Four book - this book is easily the most extended ode to the Visitor pattern that has and likely ever will be written. So, perhaps like a ladder that must be kicked away after climbing it, the real value of this book is, upon completing it, understanding why you might not want to actually *use* the Visitor pattern.

Now, having said all that, I plan to re-read this book in the near future after letting it stew a while. It took me many months to read, re-read, and fully appreciate The Little Schemer and The Little MLer - and I am sure my appreciation will only grow in the years to come with subsequent re-reads. My faith in Felleisen and Friedman is such that I am willing to give them the benefit of the doubt.
Profile Image for Alex.
168 reviews17 followers
November 22, 2017
Not as good as Little/Seasoned/etc Schemer, but still interesting.

The weirdest thing is probably that all examples are in Java, but at the same time, they aren't due to the usage of the superscripts and some mathematical symbols. Given the fact that they had to do some extreme name shortening to fit the source code into narrow columns I'd probably consider ditching the Java syntax and use more pseudo-code style since it will be very easy to translate to the actual Java code, but it will be more readable.

It was interesting to see some footnotes making parallels with the functional programming. In fact, I probably would want more of that.

Also, it was clear that the book was written way before the introduction of templates in Java. It would help to avoid some type-casting and heavy-use of Object as a most common denominator type.
Profile Image for Alex.
38 reviews2 followers
October 4, 2024
I'm not sure who this book is meant for. Its narrow focus on the visitor pattern won't give beginners a full picture of OOP, while people familiar with OOP won't find much new here.

The functional style makes sense in scheme or ML, but it's plain weird in Java. The code turns out more complicated than it could be, were it written idiomatically. I'm curious if the focus of the book on the visitor pattern is because the authors are treating only recursively defined types or the other way around. I suspect the former.

The Socratic style is somewhat offputing as are the constant references to fold which make the cose samples somewhat harder to understand than they could be.

There's more to life than cons.
24 reviews
May 7, 2025
Coming from Matthias' HTDP book, I think this book falls short. I am new to reading about patterns so I do think the Socratic dialogue setup of this book was an interesting interactive approach.

The problem is that it becomes hard to follow because the examples are made to fit the layout of the pages. There is a lot of going back and forth between pages to follow the section. The code examples are changed from working Java code to fit the layout (as others suggested, maybe pure pseudo code would have been better?). It is also really just the Visitor Pattern throughout the whole book so its really not "a few patterns."

15 reviews
April 26, 2020
The book includes neither java or design pattern. It contains exactly one design pattern which is the visitor design pattern. It talks very little about java as well. The book should be tiltled as "functional programming with outdated java". It does have some interesting points but it is way too long to express these points.
52 reviews1 follower
September 16, 2017
read this a really long time back. no longer useful for java (to the degree it ever was), but people new to functional programming can still quickly pick up some ideas from it. Would rather recommend The Little MLer for that purposse though
21 reviews3 followers
March 22, 2020
A very pleasant and interesting read, even for seasoned Java programmers! Written in this famous style, doesn't really require the pc, so can be consumed while on the beach, on vacation, etc. ;)
Profile Image for Carl-Erik Kopseng.
26 reviews14 followers
August 3, 2011
First a bit on the Kindle version:
One star is subtracted for the electronic conversion. I fully understand that they needed a fixed layout and font-size in order to keep the original two-column layout work with the code examples without overflowing, but this comes at the cost of losing all the benefits of the layout that Kindle provides. The font also looks a bit weird - possibly a pdf->mobi conversion with OCR. Reading on my regular Kindle is taxing, but it is ok. The screen size of the Kindle DX is probably a far better match, as is my computer screen, but I cannot stand to read using that for long. I managed to read it on my Kindle, but it was annoying. Just a word of warning.

As to the actual content of the book, I found myself enjoying it (after a while). I have to admit that there were some frustrations/questions that were nagging me for most of the book, but they were dealt with when just a tenth of the book remained. This was due to the author's wish to gradually build up a sense of how one ends up with the final version of the Visitor pattern, but I am unsure of the real value in showing so many less desirable versions of it first.

The style is very reminiscent of The Little Schemer (TLS), a book I have on my shelf, but one I never finished - mostly due to not knowing how to run the code. This book actually starts with a section on how one can test the code, so that is not a problem here. The other difference from TLS is that I read this book with a good working knowledge of Java. Thus I never felt the need to actually test any of the code.

One problem I have with the book is its class hierarchy and the names given to classes. The examples often use food classes and one of them is the shish kebab and its ingredients. There we have a class Shish and several ingredients like Onion, Lamb, etc that subclasses Shish. I find that very weird. I would think that a Shish HAS-A ingredent, not that an ingredient IS-A Shish. If the author had just somewhat refactored the classes to use composition I would be OK with the whole thing. The other examples have the same problem. Other than the issues with how the class hierarchy was composed, the code is quite nice and what you end up with in the end is very elegant code. I believe that the reviewers that most violently object to the code have not been exposes to much advanced OO design before and anything else than getters and setters probably freaks them out. It is not a shining jewel in my book collection, but it is interesting and absolutely worth reading. The last 20% percent of the book makes the initial frustration quite worth it.

In short, I recommend reading it, if just for the experience of the different teaching format.
Displaying 1 - 11 of 11 reviews

Can't find what you're looking for?

Get help and learn more about the design.