Get out of rails and see Ruby: Understand Ruby before you catch the rails bandwagon

Source: Internet
Author: User
Tags definition ruby on rails

Introduction: Ruby on Rails is just one aspect of making Ruby very powerful, just as EJB is part of the Java Enterprise platform. Andrew Glover reveals what Java developers can do with Ruby.

Before I begin this article, I need to clarify a few things. First, it's not an article about Ruby on Rails. If you want to learn about Rails, there are articles and blogs that are relevant every week (or even hourly), and they all add up to the many features of this exciting framework; see resources for a list. Second, this article is not intended to predict that Java's better language, tools, and frameworks will go down in the face of Ruby on Rails. So this article does not cover topics that are most commonly associated with Ruby recently.

Don't get me wrong--I think Rails is unbelievable! It is extremely powerful and has dramatically changed the face and pace of Web development. I just want to point out that Ruby is a lot more functional than Rails, especially from a Java developer's perspective.

The specialty of Rails is Web site development, but I haven't built a brand new Web site myself. Most of the Web sites I work with have been built with Struts, Tapestry, or other technologies. When I was using Ruby, I basically used it as a development practice for interfacing with the Java platform. So in this article, I'll talk about how to exploit Ruby if you're primarily a Java developer.

The feeling is so different

Ruby's syntax differs from that of the Java language. First, Ruby has no brackets or semicolons, and it makes the type completely optional. One might say that Ruby's syntax is concise, and that's what it's all about: The language allows developers to quickly write concise code.

If you define the same class separately in the Java language and Ruby, you can see this simplicity by comparing. Let me first give you two classes of--word and Definition (like a dictionary) written in the Java language. In the simple class diagram shown in Figure 1, you can see that the two classes have several relationships (if this complexity seems unnatural, please bear with it; it makes sense!) ):

A word can have a collection of synonyms (instances of Word).

A Word also has a Definition collection.

A Definition has an aggregation association to Word.

Figure 1. A simple dictionary with words and definitions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.