Friday, December 31, 2010
OSGi book preview and press release
If you've never heard of OSGi, the following press release about the book might help provide some idea what it's all about. Here's the release:
Build your OSGi applications using Packt's new Apache Felix book
Packt is pleased to announce OSGi and Apache Felix 3.0 Beginner's Guide, a new book that will help readers to build their very own OSGi applications using the flexible and powerful Felix Framework. Written by Walid
Joseph Gedeon, this book will assist readers to get acquainted with the OSGi concepts in an easy-to-follow manner and build a completely operational real-life application using Felix.
Apache Felix is an open source implementation of the OSGi Release 4 core framework specification. Furthermore, the OSGi specifications originally targeted embedded devices and home services gateways, but they are ideally suited for any project interested in the principles of modularity, component-orientation, and/or service-orientation.
OSGi and Apache Felix 3.0 Beginner's Guide starts off with an introduction to the OSGi Service Platform, its parts and its bundle structure. It then walks users through setting up the Felix framework and their development environment. Additionally, this book explains the operation of the Felix Framework by means
of Gogo and teaches users practical implementation of OSGi, OBR repositories, dependency management, and bundle version management.
Using this book, developers will be able to discover the practical implementation of important OSGi concepts, understand the use of Maven to build and deploy OSGi bundles, create an OSGi-compliant application, learn the implementation of JSP Web Application Bundles, dive deep into Felix iPOJO, get an overview of the Felix Web Management Console and learn to troubleshoot an OSGi application with ease.
A relentlessly practical beginner's guide with step-by-step instructions, this book is ideal for Java developers, who wish to learn about writing reusable and network distributable software following the OSGi standards using the famous Felix framework. The book is out now and available from Packt. To read more about it, please visit: www.packtpub.com/osgi-and-apache-felix-3-0-beginners-guide/book
Well, there's the preview. Watch for a review in the near future!
Happy Holidays!
Wednesday, December 22, 2010
Pythonistas -- Packt books discounted this month!
Tuesday, December 21, 2010
Coming Soon: Apache Felix & jBPM
OSGi is an interesting topic. Application server vendors and near-application servers like Spring are making provisions for it in their future offerings. Apache is helping lead the charge with Felix, an open source OSGi implementation. I hope to soon review a new book on the basics of OSGi, "OSGi and Apache Felix 3.0 Beginner's Guide" from Packt. Watch this space for a review in the near future.
BTW, how about that crazy upper/lower-case letter treatment for these two books? Totally coincidental!
Saturday, December 18, 2010
Book Review for "Jboss AS 5 Performance Tuning"
Thursday, December 9, 2010
JBoss Performance Tuning Book is out!
The much-anticipated JBoss Tuning book is available now, and my copy is in the mail.
The book is authored by the same guy who brought us the JBoss 5 Development book, which I liked, so I look forward to reading this one.
Watch here for a review soon, else buy your copy today here.
Happy Reading!
Training Review: JB325, JBoss for Advanced Developers
I've just finished JB325, a four day live-instructor class. It was an intense 4 days. Roughly, here's what was presented:
JBoss architecture
The inside scoop on how the JMX microkernel and POJO microcontainer act as the framework upon which all the running parts of JBoss are placed. (Hint: you can change it all, through configuration files!) We learned the startup procedure and main abstractions involved, as well as important stuff like classpath isolation techniques. (Experienced JEE developers will probably recognize the need for these.)
AOP, Invokers, Interceptor stacks
Several times we discussed AOP in JBoss and the way chain-of-command is used to build stacks of interceptors used throughout the architecture. The 'Invoker' concept was also thoroughly explained.
JCA, DataSources, and Transactions
Valuable especially in preparing databases and JMS providers for use.
JBoss Cache, Clustering, and JGroups
Clustering is easy with JBoss, right out of the box. This section of the class showed us how it all works and how you can exploit the individual parts if you'd like.
Performance Tuning
This part alone made the class worth attending. Java performance tuning knowledge is always useful, we got some great tips here. (By the way, have a look at the blog post about the new JBoss tuning book.)
Security
As it applies across all the tiers.
Messaging
JBoss Messaging, how it's configured, and how it's used.
Student workstations were provided. Students were given the software (including the IDE) and were required to configure their own environments. Labs were challenging-- sometimes there were some easy parts, sometimes there were significant challenges.
Lunch was provided and was delicious every day. (Not relevant, I know. But if I were shopping around for a class, I'd want to know!)
The bottom line: I recommend this class to anyone using JBoss that's got a handle on application basics already. If you're not sure what goes into a .ear, you're probably not ready yet. But if you've done your share of development on the 'Boss already, you'd probably like this one.
Happy learning!
Saturday, December 4, 2010
The 'Other' Erlang book
Tuesday, November 16, 2010
Prestashop wins Open Source Award
Packt Publishing is pleased to announce that PrestaShop has won the inaugural Open Source E-Commerce Applications Award category in the 2010 Open Source Awards. Open Source E-Commerce Applications Award is a new category introduced to the Award this year, featuring various different types of type of web applications that simplify buying and selling of products on the Internet.
“This award is a great recognition for PrestaShop's hardworking team and, of course, the contributors who help us enrich our software every day,” said Bruno Lévêque, PrestaShop Co-Founder.
“We are glad to have received this award from both a panel of expert judges and our growing Community -whose members increased threefold in the past year! They have really mobilized to support our project,” adds Sabrina Maréchal, Head of Marketing & Communications for PrestaShop.
“PrestaShop have achieved a lot in a short period of time considering that it is a community driven project, with the product maturing steadily and in a way that will stand the test of time.” Added Paul Anthony, bespoke e-commerce solutions developer and one of the judges for the 2010 Open Source E-Commerce Applications category. “The structure of the product has also given rise to numerous creative implementations, and the community is large enough and responsive enough to cope with these requests for improvement.”
“Every day more than 40,000 merchants use PrestaShop to manage their online activity and we want to continually improve our software for them, as well as our future users and developers,” concludes Bruno Lévêque.
While PrestaShop occupied the top spot in the 2010 Open Source E-Commerce Applications category, popular shopping cart system OpenCart came in at the first runners up position, while the second runners up position was secured by TomatoCart.
With this announcement, the 2010 Open Source Awards has four more categories left, including the Open Source CMS category, for which results will be announced from November 17th through to November 19th.
For detailed results on each category and more information about the Award, please visit: https://www.packtpub.com/open-source-awards-home.
Happy Open Sourcing!
Monday, November 15, 2010
Pimcore Wins the 2010 Most Promising Open Source Project Award
Packt Publishing is pleased to announce that Pimcore has won the Most Promising Open Source Project Award category in the 2010 Open Source Awards. The Most Promising Open Source Project Award, sponsored by OpenCandy, is a revamped category for the Award this year, featuring Open Source projects, whose first release date is less than two years from 9 August, 2010.
“Winning this Award is a huge boost”, said Dietmar Rietsch, the founding member of Pimcore. “It’s not simply about the money either, it’s the recognition of a year of hard work and dedication from the team and Pimcore’s community.”
“Pimcore is an exciting content management system framework which has great long-term prospects. The project is growing at a fast rate and has good support from its community.” Added Marc Delisle, system administrator and one of the judges for the 2010 Most Promising Open Source Project category. “Pimcore is an easy to use new solution and a high sense of professionalism can be found in everything from the project website to the documentation.”
While Pimcore occupied the top spot in the 2010 Most Promising Open Source Project category, TomatoCMS came in at the first runners up position, while the second runners up position was secured by social networking software package BuddyPress.
With this announcement, the 2010 Open Source Awards has five more categories left, including the Open Source Graphics Software category, for which results will be announced from November 16th through to November 19th.
For detailed results on each category and more information about the Award, please visit: https://www.packtpub.com/open-source-awards-home
Saturday, November 13, 2010
Book Review: "NHibernate 3.0 Cookbook"
Book Review: "Spring Dynamic Modules in Action"
Saturday, October 30, 2010
4 tips to get your support ticket worked pronto!
Thursday, October 28, 2010
ORM the Hibernate way -- on .Net!
Saturday, October 23, 2010
How to find which .jar a class is in (easily)
A Java developer feels this pain in a couple of ways:
- Compile time, manifested with errors such as "(ClassName) cannot be resolved to a Type" or "The import some.class.SoughtFor cannot be resolved".
- Runtime, where the errors will show themselves with messages like the all-time favorite "java.lang.ClassNotFoundException".
But what if you had a report like this? Wouldn't that be nice?
So what do you do then? Many coders start by trying to guess which .jars hold the missing classes, then add them to the classpath one by one. This can be an exercise in frustration, as often times .jar names give you little clue as to which classes are inside.
A second methodology developers sometimes use is the 'throw everything but the kitchen sink at it' approach, where they build huge classpaths loaded with every .jar they can find. This inexact coping mechanism obviously leads to bloat.
But wait! There is an exact way to cure the problem, and it's easy and open sourced! Here's how to do it:
1) Download and unzip JBoss Tattletale. It can be found here.
2) Make a run script for Tattletale.
3) Run the run script.
4) Read the report Tattletale makes for you. It's that easy!
The script is easy to write. It takes the form 'java -jar tattletale.jar DIRECTORY_TO_RECURSIVELY_SEARCH DIRECTORY_FOR_REPORTS.
Here's an example:
java -jar tattletale.jar /home/rick/Tools/JBoss/jboss-5.1.0.GA /home/rick/rpts
Then you just go to the reports directory and view the index. To find your classes in .jars, have a look at the 'Class Location' report. It'll tell you which jar holds the missing classes!
Tattletale has many more capabilities, which are well documented in the packaged docs. I hope you'll find this tool useful in your day-to-day development work.
Happy Coding!
Saturday, October 9, 2010
Solve your Java runtime mysteries easily with Byteman
Use the following to easily use Byteman on AS7, using the HelloWorld quickstart:
-- Script to attach, check, and submit rule -----
#!/bin/bash
export JBOSS_HOME=/home/rick/Tools/JBoss_Org/jboss-as-7.0.2.Final
echo $JBOSS_HOME
export BYTEMAN_HOME=/home/rick/Tools/MISC_TOOLS/byteman-2.0/byteman-download-2.0.0
export BYTEMAN_BIN=$BYTEMAN_HOME/bin
# Only install once.....
# $BYTEMAN_BIN/bminstall.sh -b -Dorg.jboss.byteman.transform.all $JBOSS_HOME/jboss-modules.jar
export QS_HELLOWORLD_TGT=/home/rick/Tools/JBoss_Org/jboss-as-quickstarts-7.0.2.CR1/helloworld/target/classes
# check it
$BYTEMAN_BIN/bmcheck.sh -cp $QS_HELLOWORLD_TGT RicksScript.btm
# add the rule
$BYTEMAN_BIN/bmsubmit.sh RicksScript.btm
-------The Rule. Check the arbitrary Java code used! --------------
RULE trace main entry
CLASS org.jboss.as.quickstarts.helloworld.HelloService
METHOD createHelloMessage
AT ENTRY
IF true
#DO traceln("entering createHelloMessage")
#DO traceStack("found the caller!\n", 100)
DO System.out.println("Hey, I'm random java code!");
ENDRULE
-------------
Have you heard of Byteman? It's sort of like AOP-lite. With a small script and a lightly doctored startup command, you can have x-ray vision into your Java applications. You don't even have to alter your source code, and it's easy to use.
- Make your application into a jar (using jar -cvf someJar.jar *.class, perhaps). This is done as a convenience to make it easier to put on a classpath.
- Make a Byteman script, telling it what you want to see.
- Make a command-line script to invoke your application.
#
java -javaagent:/home/rick/Tools/Examples/Byteman/byteman-1.3.0/lib/byteman.jar=script:clue_script.txt -classpath clue.jar Clue
Saturday, October 2, 2010
Voting now open for 2010 Open Source Awards
Open Source CMS Award
Every Content Management System (CMS) that is based on one of the Open Source licenses is eligible to participate for this category. Vote for your favorite Open Source CMS here.
Finalists:
- CMS Made Simple
- MODx
- mojoPortal
- SilverStripe
- XOOPS
Hall of Fame CMS
This category is reserved for those CMSes that have won the Overall Open Source CMS Award at least once in the past. Since the launch of the award in 2006, only Joomla!, Drupal and WordPress have won the Overall Open Source CMS Award, therefore, this category will feature only those three participants in 2010. Vote for your favorite Hall of Fame CMS here.
Finalists
- Drupal
- Joomla!
- WordPress
Most Promising Open Source Project
This category is for all Open Source projects, whose first release date is less than two years from 9 August, 2010. Vote for your favorite Most Promising Open Source Project here.
Finalists
- BuddyPress
- LiveStreet CMS
- Pimcore
- Tomato CMS
- WolfCMS
Open Source E-Commerce Applications
This category is reserved for the type of web applications that simplify buying and selling of products on the Internet. This will include complete e-commerce applications or frameworks designed for e-commerce. E-commerce modules or extensions to other systems can also be nominated. If a system is general purpose (like a CMS such as Drupal or Joomla!) the specific e-commerce functionality should be nominated, not the base system.Vote for your favorite Open Source E-Commerce Applications here.
Finalists
- Magento
- nopCommerce
- OpenCart
- PrestaShop
- Tomatocart
Open Source JavaScript Libraries
This category is reserved for JavaScript libraries, libraries of pre-written JavaScript controls which allow for easier development of RIAs (Rich Internet Applications), visually enhanced applications or smoother server-side JavaScript functionalities.Vote for your favorite Open Source JavaScript Libraries here.
Finalists
- Dojo ToolKit
- Ext JS
- jQuery
- Mootools
- Raphaël
Open Source Graphics Software
This category, as the name suggests, is for all Graphic Application Software that is used for graphic design, multimedia development, specialized image development, general image editing, or simply to access graphic files. It can also include graphics libraries, which use command line references or programming language inputs to design or edit graphics.Vote for your favorite Open Source Graphics Software here.
Finalists
- Blender
- Gimp
- InkScape
- jMonkeyEngine
- Scribus
Monday, September 13, 2010
Book Review: "Drools JBoss Rules 5.0: Developer's Guide"
Saturday, September 11, 2010
New, less expensive Online Book Library available
- I like the cost, compared to Safari or Books 24 x 7. Packt is a little less than $200 a year, where the others are right at $500.
- The catalog size is less than what the competitors offer. Both Safari and Books 24 x 7 host titles from a list of publishers, where Packt is offering books from their catalog only.
- With the trial account, you get access to 9 free titles. I don't have an interest in most, but there is a Plone development title there and one on Microsoft Live Small Office, though. I think those would be interesting.
Monday, August 16, 2010
Book Review for "Plone 3.3 Site Administration: Manage your site like a Plone professional" by Alex Clark
Monday, August 9, 2010
2010 Open Source Awards now open
Do you have a favorite open source project? Would you like to thank an open source provider in a tangible way? How about nominating them for the 2010 Open Source Awards, a contest put on by Packt Publishing that offers US $24K in cash awards?
Packt launch fifth annual Open Source Awards
Birmingham, UK. 9th August 2010
The 2010 Open Source Awards was launched today by Packt, inviting people to visit www.PacktPub.com and submit nominations for their favorite Open Source project. Now in its fifth year, the Award has been adapted from the established Open Source CMS Award with the wider aim of encouraging, supporting, recognizing and rewarding all Open Source projects.
WordPress won the 2009 Open Source Content Management System (CMS) Award in what was a very close contest with MODx and SilverStripe. While MODx was the first runner up, SilverStripe, a Most Promising CMS Award winner in 2008, made its way to the second runner up position in its first year in the Open Source CMS Award final.
The 2010 Award will feature a prize fund of $24,000 with several new categories introduced. While the Open Source CMS Award category will continue to recognize the best content management system, Packt is introducing categories for the Most Promising Open Source Project, Open Source E-Commerce Applications, Open Source JavaScript Libraries and Open Source Graphics Software. CMSes that won the Overall CMS Award in previous years will continue to compete against one another in the Hall of Fame CMS category.
These new categories will ensure that the Open Source Awards is the ultimate platform to recognise excellence within the community while supporting projects both new and old. “We believe that the adaption of the Award and the new categories will provide a new level of accessibility, with the Award recognizing a wider range of Open Source projects; both previous winners while at the same time, encouraging new projects” said Julian Copes, organizer of this year’s Awards.
Packt has opened up nominations for people to submit their favorite Open Source projects for each category at www.PacktPub.com/open-source-awards-home . The top five in each category will go through to the final, which begins in the last week of September. For more information on the categories, please visit Packt’s website www.PacktPub.com/blog/packt’s-2010-open-source-awards-announcement
Contacts
Julian Copes
PR Executive, Packt Publishing
julianc@packtpub.com | www.PacktPub.com
About Packt
Packt is a modern, unique publishing company with a focus on producing cutting-edge books for communities of developers, administrators, and newbies alike.
Packt’s books and publications share the experiences of fellow IT professionals in adapting and customizing today's systems, applications, and frameworks. Their solutions-based books give readers the knowledge and power to customize the software and technologies they’re using to get the job done.
For more information, please visit www.PacktPub.com
3 Great (and Free!) Tools for Knowledge Workers
Spreeder
This website helps me to read material at a much faster rate than I normally would. You can dial up the rate (in words per minute) so you can control how fast you read. You provide the text, via cut-n-paste. Sometimes I miss having the diagrams, and the structure of the words is lost, but all things considered this is a great tool.
www.spreeder.com
Freemind
This desktop app is great for helping you round out your ideas. I'm not sure why it helps so much, but for me it does. You quickly get used to adding new ideas, prioritizing them, shuffling them around, etc. It's really very easy to get started.
http://freemind.sourceforge.net/wiki/index.php/Main_Page
jMemorize
Here's another desktop application, this time one that helps me to remember things. As an example, I am just terrible at remembering people's names-- but jMemorize helps with that! By making electronic flashcards (yes, images can be put on one side!) you can use the provided 'Learn' mode to review all the cards in a group, removing the ones you get right. It's easy to use, you just run the java jar and away you go.
http://sourceforge.net/projects/jmemorize/
I hope these are as useful to you as they are to me.
Happy Thinking!
Rick
Wednesday, July 28, 2010
Book Review for "Plone 3 Multimedia"
If you're not experienced with Plone, you probably need not pick this one up for a while. But if you are running Plone and want to use video, audio, photos, etc. to snazz it up-- there's a lot here for you. Here's the full review:
Plone 3 Multimedia
This is a book for Plone power users and administrators. The focus of the book is on multimedia capabilities, the content type is a wide-ranging survey with details for each of the many mini-subtopics. For anyone with a need to add multimedia content to a Plone site, I would recommend this book.
Chapter 1 is a brief chapter that defines Plone, ZCA (Zope Component Architecture), the excellent zc.buildout, and multimedia itself. The author gives us a brief introduction to Plone4Artists, which is an initiative that addresses many multimedia concerns.
Chapter 2 is all about images. The author tells us how to organize, resize, and group images in ways that make the site more appealing to the user. You are taught how to produce thumbnail images (which can be clicked into larger images) and how to use gallery/slideshow products. This is the first chapter to use a recurring theme: The author first explains the capabilities of a basic Plone installation, then later explains what sort of add-ons you might use to gain further capabilities. This is a meaty chapter with lots of technical content. If you're a serious Plone admin, this chapter alone might make the book worth your while.
Chapter 3 is the audio chapter. Audio formats are explained along with the advantages and disadvantages of the various types. A good explanation of audio metadata is included-- I found that part especially interesting. The author explains how to include audio players on your Plone site, and demonstrates writing a player view in HTML5. Like chapter 2, this chapter is a deeply technical one with plenty of specific advice to guide the reader.
It seems only natural that video content should follow audio and images, and so it is. Chapter 4 tells us how to stream and embed videos in your Plone site, also how to leverage videos hosted on external sites like YouTube. By now you'll recognize the familiar chapter format: First the basic capabilities of Plone are covered, then fancier alternatives are introduced including the Plone4Artists parts that address this chapter's needs. Once you recognize the chapter layout pattern, it really makes the material easier to divide into logical sections.
Chapter 5 concerns Flash in Plone. Several Flash helpers are covered, as well as some problem spots that can be avoided. As a special bonus, Silverlight is given coverage, too.
The next chapter was really interesting to me-- it was all about content organization and control. The first part dealt with categorization, and ways to optimize flexibility in Plone's folder-centric way of doing things. This was followed by a good discussion on content metadata, and an explanation of the Dublin Core standard for metadata. Tagging and rating of content followed this, and geo-location and the use of maps was the ending of chapter 6. There was enough information here that I am going to read it again!
Chapter 7 was all about Syndication, including RSS and Atom. As usual, the author outlined what a basic Plone installation can do, then suggests some add-ons that can further enhance your Plone site. Another common theme throughout the book is the suggestion of add-ons that will be helpful for the current problem set, then advice on how to configure the add-on for best usage.
Chapter 8 covers advanced uploading techniques. Say you have a whole photo album you'd like to move onto Plone, but you'd really rather not do it one file at a time. This chapter is for you, then! The author discusses FTP, WebDAV, and a few external tools that can be of use in this case.
The next chapter is all about persisting data. The author first covers the vanilla Plone default (ZODB, the object data base) then offers alternatives. The main concern is large binary files, which is natural since this book is all about multimedia data types. For these, Plone can be configured to use external sources (like YouTube) or file system mechanisms to hold the data outside of ZODB.
Chapter 10 is the final chapter of the book, and it covers the important topic of performance optimization. Varnish, the reverse proxy cache server is explained as is the Red5 video server. CachFu, a commonly used content caching mechanism, is also explained.
You might think 10 good technical chapters would be enough, but as they say on infomercials, that's not all! You also get not 1, not 2, but 3 appendices. Appendix A covers multimedia formats and licenses, including a nice explanation of various codecs you're likely to encounter. Appendix B is about Syndication formats, including RSS1, RSS2, and Atom. Appendix C covers links and places to find more information about Plone, it's build-out system, and more.
All things considered, this book is just what it purports to be-- an excellent resource for anyone using Plone to host multimedia content. There is enough diversity and depth in this book that I'm sure nearly everyone will learn something new (and many of us will learn many new things!) I would not recommend this book for a Plone newbie, as there is no gentle introduction preceding the technical content-- the author assumes the reader is already a reasonably competent Plone integrator. (This is all spelled out on the book's back cover and in the introductory text, though. If you miss that and come away disappointed, shame on you.) I'm sure this book will soon become a go-to reference for Plone lovers everywhere.
The book can be found here.
Happy Reading!
Free eBooks!
Once in a while, something really good comes along and you feel you just have to share it with people. That's what's going on today, I have some free eBooks to share.
Packt Publishing has recently decided to give away some of it's eBooks, free of charge. Here are at least 5 titles:
Building Online Communities with phpBB 2
Upgrading to Lotus Notes and Domino 7
Invision Power Board: A User Guide
Building Websites with e107
The PEAR Installer Manifesto
The link that told me about these give-aways is here.
Besides free eBooks, Packt is also converting their electronic books to the 'ePub' format, which promises superior display capabilities, flexibility in formatting, and a host of other benefits. There's a nice press release about it here.
I hope you find something good there.
Happy Reading!
P.S. If you don't want to follow the above link to the ePub announcement, I'll include the announcement as it reads on their site. Here it is:
by Julian Copes | July 2010 | Enterprise Articles Open Source
Packt Publishing announced today that its eBooks will be available to download from www.PacktPub.com in ePub format with immediate effect. Following feedback from customers, the fast-growing publisher made the move to provide this popular format and expects it to be well received.
ePub (short for electronic publication) is a free and open eBook standard by the International Digital Publishing Forum (IDPF). ePub allows greater flexibility with content. With an ePub-formatted book, the display of text can be optimized for the reader's device. Other ePub features include improved design and layout, Inline raster and vector images, better search functionality, while enabling DRM protection and embedded metadata.
The company’s marketing manager Damian Carvill said “Packt listens to all feedback from customers and attempts to act on it accordingly. After receiving a number of requests, we made it a priority to convert all of our existing eBooks into the ePub format. All of our future books, and we hope to publish over 20 in July, will also be available in this popular eBook format.”
Packt is inviting all customers, who have purchased an eBook, to download the ePub version of the book and enjoy its features and great flexibility. Alternatively, customers can sample the ePub format by accessing one of Packt’s free eBooks. All purchases of new eBooks from today will be made available to download as an ePub file, as well as the standard PDF.
Packt ePub formatted eBooks are available from Tuesday 20th July 2010. To access your first Packt ePub eBook, either previously purchased or one of Packt’s free eBooks, please log into www.PacktPub.com and go to My account.
Tuesday, July 27, 2010
New Plone Admin book available
I've been learning Plone lately, thanks mostly to LearnPlone.org and Packt's excellent library of new Plone titles.
A site admin can always use a book of new tips, and sure enough, Packt has that one covered too. There's a brand new title available, "Plone 3.3 Site Administration". The book can be viewed here.
There's a copy coming via mail, I promise to provide a review ASAP.
Meanwhile, please try to stay cool in the summer heat.
Happy coding!
P.S. Check that chain on the book cover-- I guess they're plugging Plone's top-notch security. I read today on Slashdot that the CIA uses Plone-- it must be pretty secure!
Monday, July 5, 2010
Book Review for "Groovy for Domain-Specific Languages"
Book Review of "Groovy for Domain-Specific Languages", or how to teach a Java guy Closures and Meta-Programming
Are you an accomplished Java Coder, but not very experienced with the 'dynamic' languages like Python, Ruby or Groovy? I am.
Sure, I know a little about all those languages, especially Python. For quite a while now, I've used Python for scripting and even for quick Hadoop jobs. But the way I used Python wasn't much different than how I'd use Java-- mostly plain Object Oriented technique at the fanciest, more likely just plain old procedural scripting for quick-n-dirty text manipulation jobs. I'd read the occasional article about dynamic language features (like closures, metaprogramming, and built-in builders) but I didn't really have a good idea what those meant.
That all changed after I read "Groovy for Domain-Specific Languages" from Packt.
Groovy, it turns out, is a language built on top of the JVM and it offers really easy integration with Java. (So much so that your Groovy code compiles to JVM bytecode, so all the current Java code you have available to you is also available to your Groovy code.) The book goes about introducing Groovy in terms a Java coder will easily understand, and I think the author did a good job in this respect.
Groovy can be an easier Java. Language verbosity is relaxed, so coders can drop parenthesis, semi-colons, and variable types where it makes sense. This saves a few keystrokes at code-writing time, but more importantly it produces code that's a lot leaner so it can be much more readable. But that's not what helps in DSL construction.
DSLs, for those of you impervious to the growing dev-space din, are "Domain Specific Languages", or little languages meant to serve a single purpose. Never heard of that, you say? How about 'Regular Expressions', 'Make', and 'Ant'? I'm sure you've heard of those! They're all examples of little language that are designed to perform some very specific task, and make the user's life easier than if they had to use a general purpose language like C or Java to accomplish something like compiling a .jar.
This book goes about explaining some of the features a dynamic language like Groovy has that make DSL authoring an easier task. One such feature is the 'Closure' something Java doesn't have at this time. So what's a closure? I'd call it a method, except it's packed up in such a way that you can send it to other methods as a parameter. Confused? Check this example:
def islanders = ["Skipper", "Gilligan"] // This is a List in Groovy
def aClosure = { println "Hello, ${it}" }
islanders.each (aClosure) // This will print "Hello, Skipper" "Hello, Gilligan"
Another DSL-friendly feature of Groovy is Meta-Programming. Meta-Programming is writing code that can change it's behavior at runtime. One flavor of this is Reflection, which I knew from Java-- given the String name of a class, I could conjure up an instance of that class. I'd also seen in Python how you can add properties to an object 'on the fly'-- if that property wasn't there, the class just somehow put it there as soon as you accessed it, and the code went chugging along. But that's just the tip of the iceberg! In Groovy you can have your class respond to method calls that you didn't write at the time the class was authored. Weird! Yet very handy if you're writing a DSL, as the book explains.
The book is really a double-whammy, covering both Groovy-for-the-Java-Coder and Best-Practices-in-Writing-a-DSL. IMHO, it covers the first topic in more detail than the second, but I liked what I got from both.
The book can be found here.
There have been several times in my career where I've written a little language, probably with mixed levels of effectiveness. The next time this topic arises, I have a new weapon to bring out, so I'm waiting on it now!
'Till then,
Happy Coding!