From Java to Ruby !!

[From Java to Ruby !!]

My current goal is to learn Ruby while learning Java. There was a comparison between Java and Ruby in the Ruby Official Reference. Refer to the official reference "From Java to Ruby" and leave it as your own memo.

From Java to Ruby

Java is mature and fast, but very verbose. Moving from Java to Ruby can significantly reduce the amount of code.

Similar to Java

Memory is managed by GC (garbage collection). Objects are strongly typed. Public, private, protected can be specified for the method.

An embedded document tool is available. The documentation generated by RDoc, a tool for Ruby, is very similar to the documentation generated by javadoc.

Difference from Java

-No need to compile code, just run it.

-There are several different third-party GUI toolkits.

-Use the end keyword at the end of the definition of classes. Don't enclose code chunks in curly braces.

-Use require instead of import.

-All member variables are private variables. Access them via methods from outside the object.

-Method call parentheses are basically optional and are often omitted.

・ Everything, including numbers, is an object

・ No static type check

-Variable names are just labels. Variable names have no associated type.

-There is no type declaration. You can use them by assigning new variable names as needed. Example) a = [1,2,3] instead of int [] a = {1,2,3};

-There is no cast, just call the method. If you see an exception, indicate the code in UT before executing it.

-The constructor is always named "initialize". (Not a class name)

-Use Mix-in instead of interface.

-YAML is preferred over XML.

・ Null is nil

-The treatment of == and equals () is different. If you want to evaluate the equivalence, use ==. [Java is equals ()] If you want to check if two objects are the same, use equal? (). [Java is ==]

at the end.

I would like to understand the program while keeping similarities and differences in the corner of my head with reference to these.

I think it is important for a person like myself to manage the amount first in order to improve his technical skills. We will continue to increase the output.

Recommended Posts

From Java to Ruby !!
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Migration from Cobol to JAVA
New features from Java7 to Java8
Connect from Java to PostgreSQL
From Ineffective Java to Effective Java
Java to be involved from today
From Java to VB.NET-Writing Contrast Memo-
Java, interface to start from beginner
The road from JavaScript to Java
[Java] Conversion from array to List
Introduction to Ruby 2
[Java] Introduction to Java
Introduction to java
[Ruby] From the basics to the inject method
Convert from java UTC time to JST time
Connect from Java to MySQL using Eclipse
From installing Eclipse to executing Java (PHP)
Post to Slack from Play Framework 2.8 (Java)
Java: How to send values from Servlet to Servlet
[Java] Flow from source code to execution
Introduction to monitoring from Java Touching Prometheus
I tried to build Ruby 3.0.0 from source
Precautions when migrating from VB6.0 to JAVA
Memo for migration from java to kotlin
Type conversion from java BigDecimal type to String type
From terminal to Ruby (standard input / output)
Sample to create PDF from Excel with Ruby
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
Call Java from JRuby
[Java] From two Lists to one array list
[Ruby / Refactoring] From Ruby iterative processing like Java and C language to Ruby-like iterative processing
Run R from Java I want to run rJava
Migrate from JUnit 4 to JUnit 5
Connect to Aurora (MySQL) from a Java application
To become a VB.net programmer from a Java shop
Eval Java source from Java
Try to link Ruby and Java with Dapr
How to get Class from Element in Java
Access API.AI from Java
Kotlin's improvements to Java
[Java] How to switch from open jdk to oracle jdk
I want to write quickly from java to sqlite
Introduction to java command
Minecraft BE server development from PHP to Java
[ruby] How to receive values from standard input?
Select * from Java SDK to Azure Cosmos DB
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
Launch Docker from Java to convert Office documents to PDF
Convert Java enum enums and JSON to and from Jackson
[Java] I want to calculate the difference from the date
How to write Scala from the perspective of Java
[Java] How to extract the file name from the path
[Updated from time to time] Ruby on Rails Convenient methods
6 features I missed after returning to Java from Scala
Java development for beginners to start from 1-Vol.1-eclipse setup
How to change from Oracle Java 8 to Adopt Open JDK 9
[Java] How to erase a specific character from a character string
Ruby Regular Expression Extracts from a specific string to a string
Generate models from JSON to Swift, PHP, C #, JAVA