Ruby and Subversion

原创 2005年02月25日 17:04:00

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 made the suggestion (i.e. not me!)

However, if you have further suggestions for this list, feel free to drop me a note at jim@weirichhouse.org.

bullet Boolean methods end in ?. Dangerous methods end in !
bullet you can fit in your mind and write code without looking at the docs every six minutes
bullet less syntax and less typing
bullet Discipline. Because of its inherent flexibility, Ruby require more self-discipline
bullet "." (dot) is a method call operator. "::" (colon-colon) is a scope operator.
bullet Ruby classes are Objects (therefore String.new, not new String())
bullet Everything is an Object
bullet Ruby does not have type casting.
bullet Compared to Java, XML is agile. Compared to Ruby, XML is Heavy.
bullet Ruby has O/R mappers, so find your Ruby "hibernate", but drop any preconceptions.
bullet Don't worry about early performance optimization
bullet Enjoy closures and blocks
bullet No method overloading
bullet Don't worry about interfaces, enjoy Duck Typing.
bullet Reflection in Ruby is much easier than in Java, and more deeply into the language than the java.lang.reflect tack-on.
bullet That you can write Ruby in Java (http://jruby.sourceforge.net)
bullet Everything is an expression.
bullet local_variable, @instance_variable, $global_variable, Constants, (and @@class_variables)
bullet Java static methods do not (quite) translate to Ruby class methods.
bullet you can have variable number of parameters, and multiple return values
bullet Ruby is not a Silver Bullet, unlike Java, right? :-)
bullet Ruby is a language to be used everywhere. You use it even in templates. No need for "Velocity/JSP."
bullet Web-development is possible with other languages besides Java.
bullet Many things that you're used to thinking of as syntax are now just
bullet Ruby is strongly typed, not statically typed
bullet Ruby has extensive reflection capabilities
bullet Ruby is dynamic. You can add, remove and modify objects, classes and methods at runtime.
bullet REXML vs. JAXP. I rest my case.
bullet KISS
bullet Think in terms of methods (behaviors) instead of classes.
bullet you cannot rely on the compiler to catch trivial mistakes
bullet No explicit types. Probably the most disconcerting thing for a javahead
bullet ruby has shortcuts for accessor methods which reduces alot of redundant coding in java
bullet you can use string interpolation, ex: "x: #{@myvar}" instead of having to say "x:" + myvar'
bullet no semi-colons, optional parenthesis
bullet Ruby classes are always "open".
bullet C extensions/wrappers are *much* easier in Ruby than JNI interfaces in Java
bullet Ruby has MVC and OO programming and libraries, but drop any preconceptions.
bullet In Ruby data is strongly typed, but variables are *not*
bullet Once you start coding Ruby, going back to Java is painful.
bullet CamelCase for class names, names_with_underscores for methods and variables.
bullet stop writing so much code
bullet ri is your friend. irb is your other friend.
bullet eval
bullet the builtin classes are much faster because they're written in C and not Ruby
bullet Avoid external utility classes
bullet Use class methods to define pseudo-compile directives
bullet You probably don't need Factories
bullet Enumerable is your friend
bullet Typing is the enemy
bullet No external configuration files
bullet method_missing
bullet Singleton methods
bullet Ruby packaging vs Java packaging
bullet ruby has multiple inheritance through mixins (this is sooo nice to have)
bullet writing code in ruby, can improve the code you write in java
bullet Ruby is agile, perfectly suited for XP
bullet Ruby's OO is message based.
bullet Fixed what's wrong with Perl
bullet Fixes what's wrong with Python
bullet It's super productive (like Perl, Python and Smalltalk)- maybe 5-10x Java.
bullet Is a lot like Smalltalk, but doesn't look as funny
bullet Is a lot like JavaScript, but more OO and more for ful app development
bullet Blocks and Closures
bullet Open Classes
bullet Duck Typing
bullet "finally" is called "ensure"
bullet Use blocks for transactional behavior like like File.open does.
bullet Help at: http://ruby-lang.org/en, http://ruby-doc.org/, news:comp.lang.ruby, irc:ruby-talk
bullet An instance of a class can be extended to be subtly different, without needing to subclass.
bullet you can change your mind about whether .foo is a simple property or a complex method call, without affecting the interface to your class.
bullet HEREDOC strings with variable interpolation make large chunks of output really easy to construct.
bullet 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't imagine or remember what it was 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 are the top 10 things I like about Subversion:

  1. Atomic Commits: It's all or nothing! If even one file out of 100 has troubles, then nothing gets committed. My repository is never in an inconsistent state.
  2. 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).
  3. Hooks: Automatically kick off a build, fire an e-mail, or update my issue tracking system...just by committing some files.
  4. Web-browsable Repository: Without having to do much additional setup (other than Apache), I get to browse my repository via my favorite web-browser.
  5. Easy branching/tagging/merging: I create a new tag or branch by simply making a logical copy in the repository. Couldn't be smoother.
  6. Efficient handling of binary files: It's my understanding that binary files are stored based on binary diffs to be more efficient.
  7. Everything is versioned: Even directories and meta-data.
  8. Externals: I haven't 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.
  9. Concurrent versioning: Just like CVS. I don't have to lock something before I can commit changes.
  10. 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.

Ubuntu下svn (subversion)安装

1、下载安装包 http://subversion.apache.org/download/#recommended-release 或源码(如果已经有了其他版本的svn): http://...
  • sunnylgz
  • sunnylgz
  • 2013年12月17日 19:30
  • 2391

linux下的subversion 配置

 背景:刚刚新装的centos5 发布版,敲上命令: svnserve --version得出:svnserve,版本 1.4.2 (r22196)看来系统已为我预装了subversion,我无需安装...
  • pwlazy
  • pwlazy
  • 2007年07月28日 15:05
  • 18321

Windows下Subversion的安装及配置

Windows下Subversion的安装及配置 一、下载所需文件   服务器:Subversion v1.8.17.msi   http://download.csdn.net/deta...
  • wlzx120
  • wlzx120
  • 2017年03月08日 23:22
  • 1977

subversion与TortoiseSVN的使用

本文介绍了 Subversion 的基本概念。详细讲解了在Windows下如何安装使用Subversion与TortoiseSVN。  一、基本概念1、什么是版本控制?  简单点来说,版本控制就是数据...
  • vcmman
  • vcmman
  • 2010年11月13日 21:25
  • 9444

Subversion快速指南

Subversion(简写为SVN)作为开源社区贡献的新一代版本控制系统,已经得到越来越广泛的使用。我用过CVS(Concurent Version System,SVN的前身)和微软的VSS(Vis...
  • freefalcon
  • freefalcon
  • 2006年11月23日 00:04
  • 4787

Subversion服务器搭建

如何快速建立Subversion服务器,并且在项目中使用起来,这是大家最关心的问题,与CVS相比,Subversion有更多的选择,也更加的容易,几个命令就可以建立一套服务器环境,可以使用起来,这里配...
  • ladofwind
  • ladofwind
  • 2008年02月17日 07:49
  • 40270

windows 安装subversion1.9.4及配置

1.下载与安装 subversion1.9.4官方下载地址:https://www.visualsvn.com/downloads/ 下载后解压至将要安装目录:如我放在c盘下,结构如下: 2...
  • cuiyaoqiang
  • cuiyaoqiang
  • 2016年06月15日 11:10
  • 8509

subversion 服务详细配置

 Subversion安装成service  以前的svnserve要想成为windows服务,必须依赖于sv...
  • wbb1983
  • wbb1983
  • 2008年04月10日 18:02
  • 7485

Subversion版本管理工具服务器搭建与基本用法

搭建SVN服务端需要安装Subversion(服务端)和Tortoise(客户端) 安装完这两样东西之后,随便打开一个目录,鼠标右键任意空白处,发现右键菜单里已经多出了两个新选项 check out,...
  • xue7721
  • xue7721
  • 2015年11月22日 10:16
  • 1142

Subversion:清除或变更svn帐号信息

Subversion的帐号信息保存在:UNIX/Linux: ~/.subversion/auth/svn.simple/windows: %APPDATA%/subversion/auth/svn....
  • iefreer
  • iefreer
  • 2014年01月29日 16:12
  • 3100
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Ruby and Subversion
举报原因:
原因补充:

(最多只允许输入30个字)