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.
Java is mature and fast, but very verbose. Moving from Java to Ruby can significantly reduce the amount of code.
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.
-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 ==]
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