Arnon Rotem-Gal-Oz's Cirrus Minor
"Making IT work" - Musings of a Holistict Architect
Navigation for Arnon Rotem-Gal-Oz's Cirrus Minor - More on Ruby
Content
Sidebar
Footer
August 12, 2007
@ 09:14 AM
Comments [0]
More on Ruby
If the previous post made it look like I think everything is just perfect with Ruby - then the answer, in my opinion, is no, it isn't perfect.
For instance, Let's take a look at a basic class like the Array class, which in an effort to be "
Humane
" violates several
OO principles
.
For one it violates Don't Repeat Yourself (DRY) by including several methods that do the same (#length and #size for instance) more importantly it violates the Single Responsibility Principle by exposing Stack (#push and #pop methods) and Queue (e.g. #shift). Making an Array double as a queue is not just violating SRP is also implementation revealing rather than intention revealing.
Another, even more annoying problem is the sometime confusing scoping :
if you do something like
class Foo
attr_accessor :bar # create accessor methods for a bar attribute
def barTender(value)
bar=value
# do something with bar
end
end
What happens here is that the bar in bar_tender is a private variable of the bar_tender class so setting it doesn't affect the bar attrribute. If you want to set the bar property you need to call that with self.bar. Fortunately, the IDE I am using (Netbeans) has
recently added a warning
for this issue so I won't be doing these again.
I also find it annoying that a dynamic language like Ruby is also case sensitive so if you call something like barTender and bartender you'd get two different methods/variables etc. I guess that's why the Ruby convention is to use all lowercase i.e. bar_tender ( maybe I'll switch to that as well, you know, when in Rome..)
oh yeah and why the hell does elsif misses the "e" ? :)
And there are of course other things. I do have to say though, that on average I find Ruby code to be more readable than Java or C# - I guess it is easier to define small code DSLs in Ruby (or other dynamic languages) than it is in Java or C# but I'll write about that in a different post
Tags:
Design
|
Everything
|
ruby
Related posts:
Eventing in WCF
Architecture - It is always a tradeoff
OMeta# a .NET meta language
OOPs - an example of misusing the term OOP
Refactoring the GoF patterns (Singleton in .NET continued)
Sleep tight, don't let the test bugs bite
« Dependency Injection Revisited
|
Home
|
A&D 2007 : The eBay Architecture (Randy ... »
Comments are closed.
RSS/Subscribe
Navigation
Home
Papers, Articles & Presentations
SPAMMED Architecture Framework
SOA Patterns
About Me
Search
Featured Presentations & Papers
REST introduction (ppt)
SOA Pattern Presentation (pdf)
Fallacies of Distributed Computing (pdf)
Getting SPAMMED for architecture (pdf)
OO Primer (ppt)
Use Case Methodology for large systems (pdf)
Use Cases Methodology for large systems (ppt)
Software Architecture (ppt)
Service Oriented Architecture - Intro (ppt)
What is SOA anyway? (pdf)
O/R Mapping: Why/When (pdf)
Order my SOA Patterns Book
Published Patterns
Edge Component (pdf)
Gridable Service (pdf)
Service Firewall (html @ InfoQ)
Saga (pdf)
What I am reading
Subscribe to RSS headline updates from:
Tag Cloud
.NET (66)
A&D2007 (6)
Agile (21)
BI (2)
Cloud Computing (1)
dasBlog (1)
data (5)
Design (21)
ESB (2)
Everything (200)
Functional Languages (1)
General (62)
Google (1)
Java (7)
Mobile (2)
new (4)
OO (11)
PaperLnx (6)
Papers (3)
Project Management (8)
Q&A (1)
refactoring (1)
Requirements (2)
REST (15)
RIA (3)
ruby (8)
scalability (6)
SCRUM (2)
SOA (79)
SOA Patterns (33)
Software Architecture (175)
SPAMMED Process (33)
TDD (5)
Trends (1)
Trends (8)
WCF (2)
xsights (2)
Archives
December, 2008 (2)
November, 2008 (6)
October, 2008 (4)
September, 2008 (4)
August, 2008 (8)
July, 2008 (6)
June, 2008 (5)
May, 2008 (4)
April, 2008 (4)
March, 2008 (6)
February, 2008 (3)
January, 2008 (5)
December, 2007 (9)
November, 2007 (6)
October, 2007 (11)
September, 2007 (11)
August, 2007 (10)
July, 2007 (9)
June, 2007 (9)
May, 2007 (9)
April, 2007 (6)
March, 2007 (4)
February, 2007 (2)
January, 2007 (5)
December, 2006 (4)
November, 2006 (3)
October, 2006 (4)
September, 2006 (2)
August, 2006 (4)
July, 2006 (3)
June, 2006 (4)
May, 2006 (10)
April, 2006 (8)
March, 2006 (8)
February, 2006 (6)
January, 2006 (6)
December, 2005 (3)
November, 2005 (5)
October, 2005 (6)
September, 2005 (10)
August, 2005 (5)
July, 2005 (15)
June, 2005 (16)
All dates
All Posts
Contact the Author
Contact Arnon
Affiliations
Admin
Sign In