Feedback on "Ten Things a Java Programmer Should Know About Ruby"
This is a compilation of feedback I received for a list of things Java programmers should be aware of when looking at Ruby. This list is not the final version, nor are all (most) of the ideas in this list mine. This is merely a Temporarty Holding Spot for these Ideas While i assemble A Talk / Article / Presentation on The Topic.
IF you have a problem with anything on this list, please bring it up with the person who name the suggestion (i.e. not me!)
However, if you have further suggestions for this list, Feel Free to Drop me a note at jim@weiirichhouse.org.
Boolean methods end in?. Dangerous methods end in! You can fit in your mind and write code without looking at the docs every six minutesless syntax and less typingDiscipline. Because of its inherent flexibility, Ruby require more self-discipline "." (Dot ) is a method call operator. "::" (colon-colon) is a scope operator.Ruby classes are Objects (therefore String.new, not new String ()) Everything is an ObjectRuby does not have type casting.Compared to Java , XML is agile. Compared to Ruby, XML is Heavy.Ruby has O / R mappers, so find your Ruby "hibernate", but drop any preconceptions.Don't worry about early performance optimizationEnjoy closures and blocksNo method overloadingDon't worry about interfaces, enjoy Duck Typing.Reflection in Ruby is much easier than in Java, and more deeply into the language than the java.lang.reflect tack-on.That you can write Ruby in Java (http://jruby.sourceforge.net EVERYTHING IS An Expression.local_variable, @Instance_variable, $ global_variable, constants, (And @@ class_variables) Java static methods do not (quite) translate to Ruby class methods.you can have variable number of parameters, and multiple return valuesRuby is not a Silver Bullet, unlike Java, right? :-) Ruby is a language TO BE Used Everywhere. No need for "Velocity / JSP." Web-development is Possible with other language, bath,
re used to thinking of as syntax are now just Ruby is strongly typed, not statically typedRuby has extensive reflection capabilitiesRuby is dynamic. You can add, remove and modify objects, classes and methods at runtime.REXML vs. JAXP. I rest my case. KISSThink in terms of methods (behaviors) instead of classes.you can not rely on the compiler to catch trivial mistakesNo explicit types. Probably the most disconcerting thing for a javaheadruby has shortcuts for accessor methods which reduces alot of redundant coding in javayou can use string interpolation , EX: "x: # {@ myvar}" x: " MYVAR'NO SEMI-COLONS, OPTIONAL PARENTHESRUBY CLASSES ALWAYS" open ".c extensions / wrappers Are * MUCH * Easier in ruby Than JNI interfaces in JavaRuby has MVC and OO programming and libraries, but drop any preconceptions.In Ruby data is strongly typed, but variables are * not * Once you start coding Ruby, going back to Java is painful.CamelCase for class names, names_with_underscores for methods and variables.stop writing so much coderi is your friend. irb is your other friend.evalthe builtin classes are much faster because they're written in C and not RubyAvoid external utility classesUse class methods to define pseudo-compile directivesYou probably do not need FactoriesEnumerable is your friendTyping is the enemyNo external configuration filesmethod_missingSingleton methodsRuby packaging vs Java packagingruby has multiple inheritance through mixins (this is sooo nice to have) writing code in ruby, can improve the code you write in javaRuby is agile, perfectly suited for XPRuby's OO Is Message Based.Fixed What's Wrong with Perlfixes What's Wrong with Pythonit '
s super productive (like Perl, Python and Smalltalk) - maybe 5-10x Java.Is a lot like Smalltalk, but does not look as funnyIs a lot like JavaScript, but more OO and more for ful app developmentBlocks and ClosuresOpen ClassesDuck Typing " Finally "IS Called" Ensure "Use block file file.open does.help at: http://ruby-lang.org/en, http://ruby-doc.org/, news: comp.lang .ruby, irc: ruby-talkAn instance of a class can be extended to be subtly different, without needing to subclass.you can change your mind about whether .foo is a simple property or a complex method call, without affecting the interface to your . class HEREDOC strings with variable interpolation make large chunks of output really easy to construct.For good (but subtle) reasons, you have to leave the ' ' and '-' behind.Top 10 Things I Like About Subversion
I've been using Subversion for over two months as my repository on a project at work and I've recently transitioned all of my personal projects on my Powerbook from CVS to Subversion. I'm really digging Subversion and can not imagine or remember What It is Like Before I Found IT.
I Wrote this Up A Few Days Ago for a Meeting At Work and Thought I'D Share It With Everyone In Blogspace. In No Particular Order, Here The Top 10 Things I like About Subversion:
Atomic Commits: It's All Or Nothing! IF Even Nothing gets committed. My repository is never in an inconsistent state. Tools Support: if you don't like the command line (and i do), then you have Tortoise. But since I'm an Eclipse user, I tend to enjoy Subclipse (I've read several people who say that Subclipse has problems, but I've had nothing but success with it for over two months). Hooks : Automatically kick off a build, fire an e-mail, or update my issue tracking system ... just by committing some files Web-browsable Repository:. Without having to do much additional setup (other than Apache), I get to browse repository via my my favorite web-browser Easy branching / tagging / merging:. I create a new tag or branch by simply making a logical copy in the repository Could not be smoother Efficient handling of binary files:.. It's my understanding that binary Files Are Stored Based on Binary Diffs To Be More Effect: EVEN DIRECTO . Ries and meta-data Externals: I have not had the privilege of using externals yet, but they sound darn cool Check out a project and all other projects that it depends on all at once Concurrent versioning:.. Just like CVS I. do not have to lock something before I can commit changes Easy refactoring:. I can rename a file or repackage a class and Subversion's smart enough to keep keep the file's history.And for an eleventh thing that I like: I've got an Excellent Subversion Book to Help Me Out.