Archive for the 'Uncategorized' Category

The Ruby Language

Ruby is straightforward and easy to learn. Coding for tasks is simple and can be easily maintained. In Ruby programming things work out as you expect them to do, and no surprises will spring on you. It is a transparent language as it does not hide solutions behind syntax you have written and does not need support codes to get simple things done. Programs are expressed directly and elegantly, making coding faster and the programs readable.
It is quite astonishing that when you use Ruby, more codes can be done and it works at the first try. You will see very few syntax errors, no type violations, and far fewer bugs.

Ruby as a Programming Language

The Ruby language has been used for scripting jobs, but most often it is used as a general-purpose programming language. It can be used to write GUI applications and middle-tier server processes, as well as for managing server machines and databases. Ruby is also used for working with Web pages, interfacing to databases and producing dynamic content. Some clients are using it to write artificial intelligence and machine learning programs, and have been found to be useful as a means for exploratory mathematics and formatting book publications. It is a wonderful language for creating solutions in a variety of problem domains.

Ruby as ApplyScript Replacement?

With the recent developments going on between OS X and Ruby, A lot of Ruby addicts are convinced that Ruby has the potential to be the de-facto OS scripting language of choice within the next few years. A lot of programmers find AppleScript secretive or hideous enough to avoid it wherever possible. There’s an article recently that compares an AppleScript code and it’s ruby alternative:

The AppleScript Code:

tell application “TextEdit”
get paragraph 1 of document “Read Me”
end tell

The Ruby Alternative
app(’TextEdit‘).documents[’Read Me‘].paragraphs[1].get

In reality, AppleScript is much more easier to understand, but the Ruby version is easier to remember in terms of its construction and as long as you’re familiar with Ruby syntax, you won’t get lost.

The Ruby on Rails Web Framework

Ruby on Rails is a framework for developing database-backed web applications using the Model-View-Control (MVC) pattern. Rails gives you a Ruby development environment, starting from the Ajax in the view, to the request and response in the controller, and to the domain model wrapping the database. Almost everyone from business startups to non-profits to enterprise organizations are using Rails. It is all about infrastructure, so it fits practically into any type of web application, be it software for collaboration, community, e-commerce, content management, statistics,or management. It works with a wide range of web servers and databases, just about any operating system.

Benefit of a Real Closure – What to Do with a Block Made into an Object

A closure can be reconverted into a block, so a closure can be used anywhere a block can be used. Closures are used to store the status of a block into an instance variable, once you convert a block into a closure, it is becomes an object that can by referenced by a variable. Just as they are used in other languages, closures can be passed around the object to customize behavior of methods. To pass some code to customize a method, just pass a block. But if you want to pass the same code to more than two methods — convert the block into a closure, and pass that closure object to multiple methods.

Learning Ruby

As with any other computer language, writing codes, mostly using IRB, is the best way to learn Ruby. If you have written a number of lines, place it in a file and run it. After you’ve figured out how it works, learn about the unit testing framework, try to discover the machinery that makes it work. Another way is to get involve in discussions and if you come across unanswered questions, do research, deliberate and come up with an answer. It would also be helpful if you let the program reveal itself to you, accept it as a simple program and could give you a straightforward solution to a problem.

Rails Ecosystem

The Rails program includes a host of tools and extension methods:

Generators – special Rails method that make routine the making of models, controllers, etc.
Scaffolds – type of generator that automatically creates a simple set of incorporated functionality. They are used to maintain the CRUD views and controller actions for a specific model.
Gems – pack of Ruby codes
Rails plugins – similar to Gems but are directly established to a specific Rails application.
JavaScript frameworks are openly backed by Rails – the prototype and the scriptaculous.
RDoc and RI – devices for establishing and viewing program documentation.
Rails Console – makes available a command line setting for working directly with your application.

Introducing RoR to Your Company

New ideas are not easily accepted by everyone and creating a plan of introduction may help you start the process. Here are a few basic steps to introduce Rails:

Highlight the interesting points and advantages of using the Rails technology.
Know your audience. Be aware of what they need and how Rails could meet them.
Explain how Rails differ from other technologies that are in competition with it.
Discuss real applications made with Rails, its development and performance and the system requirements.
Don’t just talk about it, show a screencasts about it.
Demonstrate how to use the Ruby technology, showing them how easy it is to use.

Choice of Technology is Fear-Driven

The choice of technology being used by customers is governed by what they consider as the standard. They don’t risk using those programs not considered to be the regulars, and developers by giving in to them they are selling their customers short. Open source framework such as Ruby on Rails is very agile but people are not that keen to use them for they don’t feel safe. However, vendors have found ways to introduce them and developers have learned how to use them. Constant use have led them to appreciate the RoR and are now convinced of its effectiveness and are enthusiastic with the accomplishments they have achieved.

Operating Ruby

Writing the best program would still be useless if people are clueless as to how it is managed. If you want to be successful in writing programs in Ruby, you should first learn how to run them. Two of the options available for running Ruby are: run commands as arguments that are passed to the ruby executable from a saved file, or from the Interactive Ruby shell; or, run Ruby programs as desktop and web applications. It is harder to make a decision regarding the method of sending the Ruby application to your users than the task of writing the Ruby program.

Next Page »