No Rails,java programmers how to use Ruby

Source: Internet
Author: User
Tags ruby on rails


First, the introduction



Ruby on Rails is just a factor in making Ruby great, as EJB is just one part of the Java Enterprise platform. This article will bring you together as a Java developer, leveraging only the functionality that Ruby itself can achieve.



Let me first clarify some questions. First, this is not an article about Ruby on Rails. If you want to learn about rails, new articles and blogs are published every week to celebrate this exciting framework and its various features. Second, this article is not a warning that the Java platform is about to crash when there are some better languages, tools, and frameworks (such as Ruby on Rails). Therefore, this article has little to do with the recent topic about Ruby.



Don't get me wrong--in my opinion, rails is pretty neat! It is so amazingly powerful that it obviously affects many aspects of web development. My only opinion is that there are more things about ruby than rails, especially when viewed from a Java developer's perspective. The specialty of Rails is web development, but I find myself not using this technique very often when building websites. Most of the sites I build are mainly using struts,tapestry or some other technology. When I take advantage of Ruby, I use it only as part of development practice. So, in this article, I'll discuss how to develop with Ruby if you're primarily a Java developer.



Second, the initial feeling



Ruby's syntax differs significantly from the Java language. First, Ruby has no parentheses or semicolons, and its type is entirely optional. Some people may say that Ruby's syntax is quite refined, and one of its purposes is to write concise code with short commands.



You can appreciate this by comparing the implementation of a relatively functional class, and in this article we first define it in the Java language and then implement it in Ruby. In this article I first use two classes: Word and definition. In the simple class diagram in Figure 1, you can see that two classes share some relationships:



A word has a synonym (also known as a Word instance) collection.



A word can also have a definition collection.



A definition has an aggregation association to Word (aggregation association).








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: info-contact@alibabacloud.com 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.