Jul 14
IBM developerWorks has a nice little article on Functional programming in the Java language: Use closures and higher order functions to write modular Java code
If you have read my blog at all, you know how I feel about closures, and this article shows some cool solutions with closure implementations.
Summary
If you work on large-scale development projects, then you’re familiar with the advantages of writing modular code. Well-structured, modular code is easier to write, debug, understand, and reuse. The problem for Java developers is that the functional programming paradigm has long been implemented only via specialized languages such as Haskell, Scheme, Erlang, and Lisp. In this article, author Abhijit Belapurkar shows you how to use functional programming constructs such as closures and higher order functions to write well-structured, modular code in the Java language
Conclusion
It has long been clear that modularity is the key to productive and successful programming on any platform. The problem for Java developers is that modular programming entails more than just decomposing a problem into parts; it also involves being able to glue small scale solutions together into an effective whole. Since this type of development is inherent to the functional programming paradigm, it seems natural to use functional programming techniques when developing modular code on the Java platform.
In this article, I’ve introduced two functional programming techniques that can be easily integrated into your Java development practices. As you’ve seen here, closures and higher order functions are not completely unfamiliar programming concepts for most Java developers, and they can be effectively combined to create a number of very handy modular solutions.
I hope this article has provided you with a good foundation for incorporating closures and higher order functions into your Java code, as well as giving you a glimpse of the beauty and effectiveness of functional programming. See Resources to learn more about the concepts and technologies discussed in this article.
Jul 14
I enjoyed reading the article on Fortune: A PC Pioneer Decries the State of Computing (I found it thanks to Ted Leung).
Although that article itself was interesting, I found the report on Kay’s ETech tour even more so:
Lisa Rein’s Tour Of Alan Kay’s Etech 2003 Presentation
He has interesting ideas on late binding. Too many people think that static typing saves them, when it is living a lie:
Most software is made by programmers creating text files that are fed to a compiler and loader which makes a runable program. One can tell how early- or late-bound a system is by looking at the things that can be changed while the program is running. For example, it is generally true of C based systems that most changes in the program have to be done by going back to the text files, changing them, and recompiling and loading them. This is even true of Java. Organizationally, this often leads to at most one or two system builds a day before most bugs can be found.
A late-bound system like LISP or Smalltalk can change pretty much everything while it is running — in fact, both these systems are so good at this that their development systems are written in themselves and are active during runtime. For example, a program change in Smalltalk takes less than a second to take effect, thus many more bugs can be run down and fixed.
But late-bound has some deeper and more profound properties that include abilities to actually change the both the structure and metastructure of the language itself. Thus an important new idea can be assimilated into the constantly evolving process that is the system.
Another aspect of late-binding is the ability to change one’s mind about already instantiated structures that are already doing work. These can be changed automatically on the fly without harming the work they are already doing.
Etc. Wheels within wheels.
These ideas are not new, but they are quite foreign and out of the scope of the way most programming is done today. — Alan Kay.
Thanks Alan.
Jul 14
I have had a bunch of people ask me about OpenCMS recently.
I just saw that there is a book on it:
Building Websites with OpenCms
This book takes you through the process of creating content-rich websites and applications using OpenCms. Although powerful and flexible, OpenCms can be daunting on first approach, but its advanced features reward the investment in learning. This book exists to ease Java developers into getting the most from OpenCms.
OpenCms is a professional-level, open source Website Content Management System, with which you can create and manage complex websites. Based on Java and XML technology, it fits into almost any modern IT environment. With hard-won experience of the practical difficulties faced by developers working with OpenCms, this book is the embodiment of the author’s expertise, and the perfect way to master the system.
In related news, there is also a new Plone book
Jul 14
Behold, Oddpost gets acquired by Yahoo
There is a lot of innovation going on here. It is going to be interesting to see what Rich Interface will be in place at Yahoo! Mail soon.
It would be really cool if the UI could be in play both online and offline, and for it to be metadata happy (like Google Mail + more).
Congrats Oddpost-ers
Jul 14
Here is another little gotcha that I have run into (again, due to not thinking and being dumb).
I would use Groovy SQL and start testing in the script leaving me with:
sql.eachRow(”SELECT userpk FROM users where email=’[email protected]’”) { user |
… do stuff
}
then at some point I would want to use a variable for the email and would end up with:
sql.eachRow(”SELECT userpk FROM users where email=’${email}’”) { user |
… do stuff
}
What is wrong with this? The quotes around the variable are wrong. You don’t think of it as “put in this variable here” as Groovy SQL can be smart and will make a prepared statement with question marks ? ? ?
So, taking out the quotes does the trick:
sql.eachRow(”SELECT userpk FROM users where email=${email}”) { user |
… do stuff
}
There is talk on allowing $email as well as ${email}. Bring it on :)
Jul 14
Ahh, finally a free spell checker for Firefox :)
SpellBound
I have been waiting for this. In IE I always use ieSpell, and have had to keep it around, and use ieView on pages where I wanted to check spelling.
No more!
Jul 13
Bill Gates had a nice little brekkie with some New Zealanders. He mentioned embracing AOP and MOA:
Davidson was more interested in a discussion about developer productivity and code reuse. Gates told the architects that Microsoft would be embracing model-oriented architecture and aspect-oriented programming. (Model oriented architecture, or MOA, describes a system that uses modelling and metadata in its construction and at runtime. Aspects identify key areas of functionality within applications
It looks like MOA will be the new acronym (and partner of DSL [domain specific languages])
Jul 13
A lot of people have been running WLS on OS X for awhile now (including myself).
For some detailed info check out: WebLogic on the Mac
There is also info from Rod Chavez’ blog (Rod works for BEA).
Jul 13
Merrick talks about generating DDL from OO design.
Letting a computer generate stuff never seems to be a perfect scenario :)
The names that it generates are never human readable. Assumptions are made without context, and you will never be totally happy with it.
So, if you really care about these things then you have two choices:
- Don’t use the tools!: That’s right. Do the DDL yourself and the mapping to your OO model
- Generate, and then fix: You can use the tool for a quick skeleton and then go through changing things. This can sometimes take more time!
I *do* like the auto-gen when I am doing prototypes / playing around as I don’t even have to think about the DDL then. In this scenario it is a nice feature for the OO mapper to have.
Jul 13
Oh man, you have to check out the short cartoon Totally GridBag.
If you have ever done GUI code (in Java especially) you will appreciate this bad boy.
I really liked the accent from down under saying “Ok, that looks like crap”, and having the code turn into the matrix.
Nicely done.