Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts

Sunday, May 13, 2007

Book Review: Build Your Own Ruby On Rails Web Applications by Patrick Lenz

by T. Michael Testi (Blogcritics.org , PhotographyToday, ATAEE)

In the past two years, Ruby on Rails has shaken up the web development industry by providing an application framework whose goal is to increase the speed and ease of web development. Computerworld named it number one of the "Five Hot Technologies of 2007." Ruby on Rails, often shortened to RoR or just Rails, is an open source project that is written in the Ruby language.

The goal of Build Your Own Ruby On Rails Web Applications is to shorten the learning curve for your ramp up to Rails. The platform is well suited to design-oriented people looking to build web applications as well as to those who are unhappy with the languages and/or frameworks they are currently using. The author clearly states "I don't expect you to be an expert programmer - this isn’t a pro-level book"

The book is divided into twelve chapters that guide you methodically toward developing a social website application. In fact, the application that you develop is based on the popular story-sharing web site Digg.com.

The first four chapters get you started in understanding what Rails is and how to install it; there are instructions for Mac OS X, Linux and Windows. You then get introduced to Ruby, a scripting language that you will use to develop your Rails application before you get into the Rails framework.

In chapter five you actually begin to develop the application, called Shovell. Here, Lenz describes using the Rails model generator to create a "story" model so that everything else can be built around it. He also discusses views and you then build a controller to handle communications between models and views.

Chapter six adds functionality via form helpers as well as building unit and functional test cases. Chapter seven looks at Ajax to add voting functionality and Web 2.0 for good looking effects. Chapter eight covers protective measures, or how to manage users and user's rights.

Throughout the core portion of the text, as well as the remaining chapters, the author is also, indirectly, teaching you about dynamic website development. You have HTML, CSS, XML as well as databases and both server and client code. I believe that by using Rails and the features of both Ruby and Rails, it makes this integrated learning almost seamless.

The remaining chapters cover more advance topics such as writing your own helpers, using callbacks, and creating complex associations. There is also more on unit and functional testing. The author describes the use of plug-ins and how they can add functionality to your site. He also describes benchmarking and debugging your site and then finishes up with deployment.

What you will learn from Build Your Own Ruby On Rails Web Applications:

• Build and deploy a complete Rails web application
• Use Rails' Ajax features to create slick interfaces.
• Reap the benefits of a best-practice MVC architecture.
• Work with databases easily using ActiveRecord.
• Create a user authentication system.
• Use object-oriented concepts like inheritance and polymorphism.
• Use migrations to manage your database schema without data loss.
• Achieve maximum code reuse with filters and helper functions.
• Analyze your application's performance using the Rails logging infrastructure.
• Benchmark your application to determine performance bottlenecks.
• Much, much more…

This is a perfect book if you are looking to get into Web 2.0 development and want a step-by-step guide to bring you up to speed. It does a good job of introducing Model-View-Controller architecture as well as laying out testing methods as being important with the implementation of unit and functional testing. Finally, I like the clear, concise and entertaining style that the author uses in presenting his material.

Book Review - Everyday Scripting With Ruby: For Teams, Testers And You by Brian Marick

by T. Michael Testi (Blogcritics.org , PhotographyToday, ATAEE)

Everyday Scripting With Ruby is a book that is geared toward the computer user who is not afraid to scale new heights to try to improve their skills. The premise is that people who use computers routinely do many repetitive tasks that would be better offloaded for a computer to do. Often they think that programming it themselves is too hard, and they cannot justify hiring someone to write a program to handle their menial tasks. Using the Ruby language, anyone who is comfortable with a computer can now learn automate these tasks with a little training.

Ruby is an object-oriented scripting language that originated from Japan. It takes some of the best features from some of the best languages and combines them to make a simple and easy to use yet powerful system for processing tasks. It is freely available as open source software and is available on many platforms including Windows, Mac OS X and Linux.

Everyday Scripting With Ruby targets three audiences. First the "Tester," the person who is involved with the development of software but thinks that programming is too hard. The second target audience is the "Analyst" or someone who manipulates a lot of data. With Ruby scripts, they can automate mundane tasks and free up more time for more rewarding things. Finally, this book is for the programmer who hates to use complex programming languages to accomplish these smaller tasks.

The book is divided into an introduction and five sections. The introduction and getting started section is an overview of what will be accomplished and the best method for success. It will also provides assistance for installing Ruby on a computer and making sure that everything is running correctly. The next sections build four separate projects with the purpose of enhancing the reader's skills and building his or her knowledge of Ruby.

"The Basics" is a project that will teach the reader how to create a system to compare two text file "inventories." The reader is given an old file and then needs to create a new file. The goal is to create a dynamic script, that when run, will note changes in the two files. While the program is somewhat trivial, it teaches a lot of important concepts within the Ruby language without getting bogged down on a complex project. The techniques would be handy for automatically comparing differences in many other files such as logs.

"Growing a Script" is about creating project that "reaches out to a version control system"; in this case the VCS is Subversion, an open source product that saves its files in text. While this would not work for the VCS that I use, it does a fine job of teaching the reader how to manipulate text files.

"Working in a World Full of People" introduces the reader to Ruby's power of Screen Scraping. That is, visiting a website and scraping the data and putting it into a comma separated value file (CSV) that can be used by a spreadsheet or to import into a preferred database program. The programmer can get into some real meaty issues of file manipulation and the use of regular expressions to parse data.

"The Accomplished Scripter" works on a project called "Watchdog" that monitors long running tests and programs. It will teach the reader how to install and configure Watchdog. In this project the reader will be learning how to work with frameworks and modify code to manipulated for custom uses. The project teaches the reader how to send text to instant messengers or email with the status of a project. Here the reader learns how to handle inheritance, working with superclass' as well as subclasses.

"The Back of the Book" contains the glossary, solutions to exercises, and the bibliography.

Everyday Scripting With Ruby is a well written introduction to the Ruby language. While it may be too simple for an experienced Ruby developer, an experienced programmer coming to Ruby would find it easy to read and a good place to learn Ruby incrementally. Some one who is not a programmer by avocation, but enjoys mucking around a computer, will find it a wonderful treat!

Friday, May 11, 2007

Book Review: Rails Cookbook by Rob Orsini

by T. Michael Testi (Blogcritics.org , PhotographyToday, ATAEE)

Rob Orsini opens his book Rails Cookbook by saying that Ruby on Rails has revolutionized the process of developing web applications and has enabled web developers to become much faster and more efficient, which allows for quicker application development. It is my opinion that the O'Reilly Cookbook series has done the same for software development. The fact is that it allows developers to become faster and more efficient, which allows for quicker development by providing time tested tricks and pearls of wisdom; exactly what you need when you need it.

Rails Cookbook is meant for someone with web development skills, but who may be new to Rails. It is also for those who are trying to learn new techniques in Rails and want a clear, concise method to learn it without having to read an entire book. In this cookbook there are over 170 recipes broken into 15 chapters. Together they provide a wide range of solutions that will help you test, debug, and improve your application.

In "Getting Started" you will learn how to install, update and set up version control with Subversion. "Rails Development" will show you how to begin development in Rails by creating a rails project and introducing other add-ons to make development more efficient.

"Active Record" shows you how to set up a relational database to use with Rails as well as working with the concept of Active Record which allows you to define the logic of your domain model using Ruby. "Action Controller" teaches you how to handle the incoming requests and how they hand off each request to a particular action. "Action View" completes the triumvirate of the Model-View-Controller (MVC) pattern by showing how the data is presented to the user.

"RESTful Development" explores the Rails world of building full-featured web services within the Rails environment. "Rails Application Testing" shows how being proactive in the approach to testing comes by writing the tests before you write the code - by thinking about what the code should not do, then creating a test to make sure that it doesn't.

"JavaScript and Ajax" ensures that the power of Rails makes it easy to deal with JavaScript and Ajax as well as some of the common effects that you can achieve using them. "Action Mailer" shows you how to set up an application to send emails as well as responding to incoming emails. "Debugging Rails Applications" will help ease the pain of debugging an application. You will learn of the many powerful tools that Rails gives to you to combat bugs.

"Security" covers things like SQL injection and Cross-Site Scripting (XSS) as well as securing ports. "Performance" will help you diagnose speed problems using HTTPerf to measure your web server performance, benchmark your code, and help you figure how best to work with page caching. "Hosting and Deployment" gets you over the hump of deploying a Rails application.
"Extending Rails with Plug-ins" shows you how to extend your Rails application by installing third-party software to accomplish tasks that the Rails framework was not designed to handle. Lastly, "Graphics" will help you to upload, store and display images using a database as well as aid in generating PDF files from a variety of source data.

Rails Cookbook will guide you through the traps and pitfalls of Rails development by providing you with the building blocks of source code to make any Rails application complete. The book will be an essential addition to your programming library.

Tuesday, May 08, 2007

Book Review - Ruby Cookbook by Lucas Carlson and Leonard Richardson

by T. Michael Testi (Blogcritics.org , PhotographyToday, ATAEE)

In the Ruby Cookbook preface, the authors begin by saying "Life is Short." Following with, and I paraphrase, "This book is meant to save you time… but a span of time is also a piece of your life. Our lives are better spent creating new things than… trying to solve problems that have already been solved." The authors hope that by writing this book, they can save you much more of your time than they spent creating the book. As has been my experience with the Cookbook series, their hope is well founded.

Ruby Cookbook is geared toward those who have some experience with Ruby or those who have a strong general background in other programming languages and are wanting to learn Ruby. If you are familiar with a number of programming languages, studying through the first ten chapters should get you up to speed quite nicely.

Ruby is an object-oriented scripting language that originated from Japan. It takes some of the best features from some of the best languages and combines them to make a simple and easy to use yet powerful system for processing tasks. It is freely available as open source software and is available on many platforms including Windows, Mac OS X and Linux.

The Ruby Cookbook contains 23 chapters broken down into loosely six functional areas; Data Structures, Idiom and Philosophy, Storing Data, Applications, Programming Techniques, and Miscellaneous Techniques. You won't find these titles explicitly listed in the book, but for organization (and so I don't have to step through each chapter) I will present, my discussion using them. Each recipe begins with a problem statement. It then follows up with the solution so if you want, you can be done and get on with your life. There then is a discussion if you want to learn more about the solution. It ends with a "See Also" which will give you addition information if the discussion is not enough.

In data Structures (chapters 1 thru 6), the authors cover the built in data structures used by the Ruby language. They cover strings, numbers, dates and time, arrays, hashes, files and directories. These deal with strict algorithmic problems. Some are as simple as 1.10's "Changing the Case of a String", some are more complex such as 4.15's "Partitioning or Classifying a Set" in which you want to partition an array based on some attribute of its elements.

Idiom and Philosophy (chapters 7 thru 10) covers items that you may encounter when you cannot get the Ruby language to do what you want. You will learn things like iteration, blocks and callbacks. You will explore objects and classes, working with superclasses and abstract methods, modules and namespaces as well as reflection and metaprogramming.

In Storing Data (chapters 11 thru 13) you will focus on how to work with three popular forms of data storage; XML, HTML, graphics and database. You will extract data from a tree structure, convert from one encoding to another as well as convert an HTML Document to a text document. You will learn how to thumbnail images, present graphing data as well as generate PDF files. You will work with YAML, MySQL, and Berkley DB as well as learning how to prevent SQL Injection attacks.

Applications (chapters 14 thru 16) will explain how to work with internet services, web development and web services. Here you will explore sending/receiving mail, working with FTP and CGI. They explain working with Ruby on Rails development as well as interacting with sites such as Amazon and Flickr. They will show you how to creat a jukebox, a whiteboard and how to charge a credit card.

Programming Techniques (chapters 17 thru 19) tend to auxiliary tasks of programming such as testing, debugging, packaging and automating tasks. You will be shown how to create and run unit tests, how to use external resources and how to profile your application. You will learn how to package and distribute your Ruby application as well as automate tasks with Rake. Miscellaneous Techniques (chapters 20 thru 23) complete the package with items such as multitasking/multithreading, user interface, extending Ruby and system administration.

Will you have need for all 300 plus recipes in this cookbook? Probably not…today, but perhaps soon! With over 800 pages, there is something for everyone.