[JAVA] [For beginners] Ruby is said to be ruby, but what about it?

Ateam Hikkoshi Samurai Inc. Advent Calendar 2017 It is the 20th day. Today, @ taka999, a middle-aged web engineer who loves sweets, will be in charge of the second year of Ateam Connect.

background

Recently, development with Ruby has become more active around. Nani Nani in Ruby, Nani Nani in Ruby ... Is it okay in PHP? .. .. There is no trick to complain without knowing anything, so I decided to investigate ruby even though I was a beginner of WEB engineer.

Introduction

Since I am a "beginner" myself, I can't explain much with the source code, and I choose a reference site that is not explained with the source code.

First of all, it is commonplace, but search for "What is Ruby?" ・ All object-oriented ・ Interpreter method ・ High degree of freedom of syntax

I see! A word that is somewhat understandable to those who have done programming, but is not kind to those who do not know it.

Feature 1: Object oriented

How many people can explain this well? .. .. I can only understand it somehow, so refer to the following. Object-oriented programming that can be understood in 5 minutes What is object-oriented? I tried to explain with an easy-to-understand example.

Objects (things) can be inherited, and if you make a basic thing, you can easily make another thing based on it and listen to applications. In the game, it's like making one basic character and then making a character with different colors and strengths based on this one. 無題.png

Feature 2: Interpreter method

Since the instructions of the programming language are interpreted and executed one by one in machine language, the source can be written and executed immediately.

■ Merit Since you can check it while executing it a little during program development, it is easy to create a program and debug it.

■ Disadvantages Since it is interpreted one by one each time, the execution speed becomes slow because the execution is performed while checking the mapping between the identifier and the position in the memory when accessing the variable.

Feature 3: High degree of syntax freedom

When it comes to syntax, there is no choice but to look at the code, so I will describe it for a moment.

■ Define integer type variables

For Java


int var = 123;

For Ruby


var = 123

■ Repeat

For Java


for (int i = 0; i < 10; i++) {
    System.out.println(i);
}

For Ruby


10.times do |i|
  puts i
end

■ switch (case) statement

For Java


switch(num){
   case 1:
        System.out.println("a");
        break;
   case 2:
   case 3:
   case 4:
        System.out.println("b");
        break;
}

For Ruby


case num
when 1
  puts 'a'
when 2..4
  puts 'b'
end

It's easy because the amount of code is small ~ Since there are few restrictions on grammar, individual tastes are likely to be reflected in Moro

Framework

There are various types such as Ruby on Rails, Sinatra, and HANAMI. Not just Ruby on Rails! 6 Ruby Frameworks

Considering the history and popularity so far, "Ruby on Rails" seems to be a good choice.

Other

~~ The library for Ruby is called "gem", and it seems that there are quite a few gems. ~~ It seems that there are many libraries used in Ruby that are packaged in a format called Gem. Even if you don't bother to make it from scratch, if you search for the function you want, there is a high possibility that it will hit and development will be easier.

Summary

I can't decide because it's a sloppy level, but although it has the same characteristics in other languages including PHP, it seems easy to develop if you can write a short code with abundant libraries (gems) without hesitation in selecting a framework. I think it's possible to start with Ruby. However, if you have already developed in another language (PHP, perl, etc.) and you are not in trouble, you do not need to change to Ruby. I sometimes choose this language because it is easy to develop, but to realize what I want to do, this language! I think it is important to select.

Finally

Ateam Hikkoshi Samurai Inc. Advent Calendar 2017 How was your 20th day? Tomorrow, the front engineer @ hashimoto-1202, who was addicted to psychology for a while at Ateam Moving Samurai "I tried to create a SPAv (single page application) using vue-rooter" Please look forward to it.

PS

The Ateam Group is looking for friends who will work together to improve web services and technologies and create the future. I changed from a business system engineer to a WEB engineer in my late 30s, and I am taking on new challenges, so if you are an engineer who could not take a step up to now, or if you are interested in Ateam Group, please do not hesitate to contact us. Please apply from the link. We are looking forward to your application! !!

[Ateam Group Recruitment Site (Web Development Engineer)](http://hikkoshi.a-tm.co.jp/recruit/request.php?ea=[Enter the key to identify the click here])

Recommended Posts

[For beginners] Ruby is said to be ruby, but what about it?
[Ruby] What is `!!` used for?
[For Ruby beginners] What is the difference between puts print p? Actually, there is a clear way to use it properly!
[For programming beginners] What is a method?
[Ruby on Rails] About bundler (for beginners)
[For super super beginners] What is object orientation?
What is Docker? What purpose is it used for?
Why null is said to be bad
[Ruby] How to use slice for beginners
[For beginners] Let's be able to coat like Swift!
[Ruby] What is true?
Scraping for beginners (Ruby)
Java beginners who used Ruby stumbled on learning Spring, what they did to solve it
The strong parameter is true, but for some reason it cannot be saved in the table.
[For Ruby beginners] Explain how to freely delete array elements!
What to do if FacesMessage is set but not displayed
What is docker run -it?
What is object-oriented programming? ~ Beginners ~
What is a Ruby module?
[Ruby] What is an instance?
What is the constructor for?
Introduction to Ratpack (1) --What is Ratpack?
Is it easy for the user to use when implementing general-purpose functions? Let's be aware of
What to do about the "cannot be read or is not a valid ZIP file" error
[For beginners] You will definitely understand in 10 minutes! What is JavaBeans?
Kantai Collection Java # 0 What is Object Oriented Programming (OOP)? [For beginners]
[Ruby version error] How to solve Your Ruby version is ~, but your Gemfile specified ~
Want to know what Ruby n is the power of 2? (Power judgment of 2)
[Note] Java: Is it necessary to override equals for equality judgment?
[For beginners] How to get the Ruby delayed railway line name
What to do if you should have installed Rails but an error occurs with rails -v (for beginners)
About the language to be learned
Divide by Ruby! Why is it 0?
[Ruby on Rails] What is Bcrypt?
What is it? ~ 3 types of "no" ~
[For Java beginners] About exception handling
What is a Ruby 2D array?
[Must-see for beginners] rails_12factor is not required to publish Rails app to Heroku
Think about what to do for SIer education for young development engineers (Part 1)
Think about what to do for SIer education for young development engineers (Part 3)
After using Android Studio 3, Java application dependencies can no longer be resolved, so what to do about it
After using Android Studio 3, Java application dependencies could not be resolved, so what to do about it Part 2