Why I don't use Ruby.

J

James Britt

James said:
Ruby is mentioned only sporadically in his book, and mostly
in the latter chapters, but in this essay he goes so far as to say that
if you showed Lisp to hackers in 1975, and said it was a dialect of Lisp
----------------^^^^----------------------------------------^^^^^^^^^

Duh.

I meant to paraphrase Graham as saying:
... if you showed Ruby to hackers in 1975, and said it was a dialect of
Lisp with some syntax added, no one would argue otherwise.
 
H

Hal Fulton

We're OT now, but my ignorance of FP is such that I can't imagine
a language without assignment.
Interesting. Paul Graham, author of a few books on Lisp, has a new book
out called Hackers and Painters. It's a collection of essays, most if
not all of which are, I believe, on his web site (paulgraham.com).

I might have to buy that, web or not. Paul Graham is cool. I find him
to be clever, profound, and insightful. (As opposed to most of us who
struggle simply to be clever and profound.)
There's an essay ("Revenge of the Nerds") toward the end of the book,
part of sequence that sings the praises of (surprise) Lisp, and in it he
mentions that many of the newer programming languages seem to follow a
pattern of each one (perl -> python -> ruby ) being increasingly more
like Lisp. Ruby is mentioned only sporadically in his book, and mostly
in the latter chapters, but in this essay he goes so far as to say that
if you showed Lisp to hackers in 1975, and said it was a dialect of Lisp
with some syntax added, no one would argue otherwise.

You must mean: s/showed Lisp/showed Ruby/
Correct?


Hal
 
S

Sean O'Dell

Incidentally, from the comp.lang.functional FAQ:

"Functional programming is a style of programming that emphasizes the
evaluation of expressions, rather than execution of commands. The
expressions in these language are formed by using functions to combine
basic values. A functional language is a language that supports and
encourages programming in a functional style."

"Definition: A language that does not allow any destructive
operation---one which overwrites data---such as the assignment
operation. Purely functional languages are free of side effects, i.e.,
invoking a function has no effect other than computing the value
returned by the function."

May I add: there is "functional programming style" and "functional programming
language." Ruby is not really a functional programming language, but you can
program in a functional style with it. If you don't maintain state, and
don't call methods that use stateful data, you are programming in a
functional style. Tail recursion optimization and currying are, I believe,
just implementation features, not really defining properties, of functional
programming.

Sean O'Dell
 
S

Sean O'Dell

We're OT now, but my ignorance of FP is such that I can't imagine
a language without assignment.

You can have variables in a functional language, but what you can't have are
globals that act statefully, causing any functions you write to return
different values when passed the same parameter values. You can have
(pseudocoded):

function myfunc(a)
b = anotherfunc(a)
return sin(b)
end

...because b is a lexically scoped variable within myfunc. It is created when
the function is called, and destroyed when the function exits. Because you
never maintain b statically or globally, and thus b cannot be changed outside
of myfunc, any given value you pass to myfunc will always return the same
value, no matter when or where you call it.

Sean O'Dell
 
A

Austin Ziegler

We're OT now, but my ignorance of FP is such that I can't imagine
a language without assignment.

Well, it's certainly possible to write a Ruby program that does no
explicit assignment. Contrived:

File.open("reversed", "w") { |f| f.write
File.readlines("original").reverse }

A bit harder, but equally contrived:

File.open("reversed", "w") { |f| File.readlines("original").each {
|e| f.write e.reverse } }

If we had a #reverse_map, then we could write an inverted, mirrored
file without explicit assignment.

-austin
 
G

gabriele renzi

il 8 Jul 2004 11:43:32 -0700, (e-mail address removed) (Sean Russell)
ha scritto::
No they aren't. car and cdr aren't methods on objects. They are
functions that take objects as arguments.


well, I agree with the Mikael, if you consider that an Object is some
state+some data+some methods (possibly the state is just a part of the
data.

In this view you can consider lisp as having one object (the list) and
some basic methods to work on that (car/cdr). If we had method call in
ruby like:

method(var1,var2) from_instance myobj

it would not be less OO.
 
M

Mikael Brockman

In this, and following posts, you make the claim (directly and
indirectly) that all languages are functional languages, rendering the
term "functional language" meaningless, or at least useless. I
oppose attempts to generalize words into meaninglessness.

No. I claim that it's possible to write functional code in any
language, provided it is sufficiently expressive. I don't claim Ruby is
a functional language.
There *are* good, useful definitions of what constitutes a functional
languages, and Ruby does not match the criteria for most of them.
Probably the most fundamental of all criteria is that the language
does not allow side-effects, such as assignment.

I think that's a very poor criteria, since most language considered to
be functional don't fulfill it. See Scheme, Lisp, O'Caml, SML, etc.
Haskell is the only mildly popular language I know of that actually
disallows side-effects, and its implementations consistently provide a
way to evaluate imperative code within the system.
I'll concede that, if you're allowed to write a lot of non-functional
code in the form of a library, it is possible to write a Ruby
application that is visually indistinguishable from a purely
functional program. I'll even grant that it is possible to write a
few very short programs using only the inherited functions in Kernel,
ignoring the fact that math in Ruby is, in fact, method calls on
objects rather than function calls or primative operations. However,
I'll maintain that this is a far cry from satisfying the claim that
one can do functional programming in Ruby.

Arithmetic is indeed implemented as method calls, but that's an
implementation detail. And that embodies my fundamental point:
paradigms are phenomena in the heads of the programmers, not properties
of the language.
Because they satisfy several other criteria that are usually
attributed to functional programming languages, such as support for
optimized tail recursion. They may not be "purely" functional, but
Ruby is about as contaminated a functional language as is possible to
achieve.

Common Lisp doesn't specify the optimization of tail calls. The
differences between Ruby and Common Lisp are mostly superficial.
No they aren't. car and cdr aren't methods on objects. They are
functions that take objects as arguments.

They are both operations on an object. The matter in which you choose
to see that is in your head. You choose to see CAR and CDR as
non-methods; I can just as easily choose to see them as methods.
Now, a better example would have been to point out OCaml, which is
*both* functional *and* OO, something which I believe is fundamentally
impossible, in that it can't be pure OO and pure functional. However,
it has a lot of features associated with functional languages, and
many features associated with OO, so it can claim to be a functional
language with OO capabilities.

Object-oriented programming is very easily done without the explicitly
OO parts of O'Caml, because the paradigm is in the programmers' heads.

mikael
 
Z

zuzu

May I add: there is "functional programming style" and "functional programming
language." Ruby is not really a functional programming language, but you can
program in a functional style with it. If you don't maintain state, and
don't call methods that use stateful data, you are programming in a
functional style. Tail recursion optimization and currying are, I believe,
just implementation features, not really defining properties, of functional
programming.

Sean O'Dell


i find this thread very iteresting, and conducted a similar
conversation in my head many moons ago.

i agree most with the "other" sean as quoted here. (p.s.
international brotherhood of seans, unite!)

ruby may not be described as a traditional "functional programming
_language_" if only because functions are not the
primary/primitive/first-order structure (sorry, the definitive word
for this has brainfarted on me at the moment, please correct); in
ruby, objects are.

however, the spectrum and natural opposite of "functional programming
_style_" is not object-orientation but _procedural_ programming. i
find procedural programming a bane on humanity (those with computers
anyway) and an artifact of von neumann architecture.

functional style and object-orientation are orthogonal to each other.

i believe a very important step in improving the defacto style or
"pattern language" in which ruby (and all) software is written, would
be to adopt a functional style and eschew procedural programming.
(but pure OO rocks the house!) for me, a more ideal style that
unifies these into object-functional is the actor or flow-based
programming (FBP) style. (sometimes simply "data flow" programming.)
http://www.jpaulmorrison.com/fbp/index.shtml
http://cliki.tunes.org/Actor
http://c2.com/cgi/wiki?ActorsAndFlowBasedProgrammingDiscussion


also, assignment in ruby is much improved over von neumann C-style
assignment. in ruby assignment is merely the naming of objects for
convenient reference (like pointers). see "Assignment" @
http://www.rubycentral.com/book/tut_expressions.html correct me if
i'm wrong, but isn't this essentially what functional programming
languages call "macros"?

-z
 
S

Sean O'Dell

however, the spectrum and natural opposite of "functional programming
_style_" is not object-orientation but _procedural_ programming. i
find procedural programming a bane on humanity (those with computers
anyway) and an artifact of von neumann architecture.

functional style and object-orientation are orthogonal to each other.

Procedural programming is a style, which a language may or may not support.
Ruby, C, Pascal, Java, etc. can all support procedural programming.

I don't believe it's effective to develop a purely OO application, only OO
components that tie together using other design patterns, such as procedural,
event-driven, etc.
i believe a very important step in improving the defacto style or
"pattern language" in which ruby (and all) software is written, would
be to adopt a functional style and eschew procedural programming.
(but pure OO rocks the house!) for me, a more ideal style that
unifies these into object-functional is the actor or flow-based
programming (FBP) style. (sometimes simply "data flow" programming.)
http://www.jpaulmorrison.com/fbp/index.shtml
http://cliki.tunes.org/Actor
http://c2.com/cgi/wiki?ActorsAndFlowBasedProgrammingDiscussion

Unless I'm mistaken, procedural programming simply means top-down execution of
an application which consists of modules/classes which contain methods which
have scope and can hide variables from other levels of scope (like static or
lexical scope). Even flow-based applications will probably become procedural
when components are invoked,and components probably start out procedural
until they fall into a "wait state" waiting for the next event to invoke
them.

Flow-based programming seems like more of an application design pattern than a
language pattern. Ruby could offer interfaces to make it easier (to promote
it), though.

I don't think you can restrict a language to just one of these paradigms
without narrowly restricting that for which the language can be used. Ruby
allows OO, functional, procedural, imperative and other paradigms because
they all have their uses at some point or other.

It's up to the developer to say "this application needs X% of this paradigm
here, X% of this paradigm there," etc. It's up to the developer to learn
what to use and when, and when to not. A person restricting themselves to
one set of concepts is a sign that they don't fully understand their
alternatives very well. Even globals and goto have their use, but a lot of
programmers don't fully understand them so they write horrible spaghetti code
with them, or disdain them completely out of fear.

It's better to have all possible tools at-hand and to learn how to use them,
than to shun the ones you haven't learned to use effectively.

Sean O'Dell
 
J

James Britt

Hal said:
We're OT now, but my ignorance of FP is such that I can't imagine
a language without assignment.



I might have to buy that, web or not. Paul Graham is cool. I find him
to be clever, profound, and insightful. (As opposed to most of us who
struggle simply to be clever and profound.)

That was my motivation to buy the book; even though I've probably
already read half the essays, I wanted to encourage him to write more,
so I'm happy to pay for the book.
You must mean: s/showed Lisp/showed Ruby/
Correct?

Indeed. And, as it turns out, if you want to read this particular
comment you have to get the book; the original essay is on-line, but it
was written in 2002 and does not mention Ruby.


James
 
Z

zuzu

Procedural programming is a style, which a language may or may not support.
Ruby, C, Pascal, Java, etc. can all support procedural programming.

I don't believe it's effective to develop a purely OO application,

out of curiousity, why?
or perhaps, how do you define "application"? (not to be pedantic, i'm
seriously questioning the concept of a monolithic application versus
combinations of utilities in the small single-purpose combined by IPC
unix sense.)
only OO
components that tie together using other design patterns, such as procedural,
event-driven, etc.


Unless I'm mistaken, procedural programming simply means top-down execution of
an application which consists of modules/classes which contain methods which
have scope and can hide variables from other levels of scope (like static or
lexical scope).

procedural programming defines top-down execution of _arbitrary_
instructions, and has little to do with modules/classes (which are OO
concepts).
Even flow-based applications will probably become procedural
when components are invoked,and components probably start out procedural
until they fall into a "wait state" waiting for the next event to invoke
them.

by how you are thinking of this, i could as well argue that functional
style is procedural because it follows the inputs and outputs of
functions.

the actual difference, however, is that both functional style and data
flow provide _context_ for when they operate and why. functional
style and data flow contain both sensors and effectors (as defined by
Cybernetics / Norbert Wiener); procedural style only provides
effectors and expects the omnicient programmer to design code like
deterministic clockwork. (Richard Dawkins probably deserves a mention
here as well.)

i suspect this is the heart of the issue behind the interest in
referential transparency and no side-effects. basically, the computer
should always know _why_ it's doing something and whether it worked
without depending on the programmer to know for it, unnecessarily.
Flow-based programming seems like more of an application design pattern than a
language pattern. Ruby could offer interfaces to make it easier (to promote
it), though.

i agree. this is why i advocate codifying flow-based programming as a
_style_ or "pattern language" of programming in ruby.
I don't think you can restrict a language to just one of these paradigms
without narrowly restricting that for which the language can be used. Ruby
allows OO, functional, procedural, imperative and other paradigms because
they all have their uses at some point or other.

It's up to the developer to say "this application needs X% of this paradigm
here, X% of this paradigm there," etc. It's up to the developer to learn
what to use and when, and when to not. A person restricting themselves to
one set of concepts is a sign that they don't fully understand their
alternatives very well. Even globals and goto have their use, but a lot of
programmers don't fully understand them so they write horrible spaghetti code
with them, or disdain them completely out of fear.

this is a fine line. i loathe C++ precisely because stroustrup favors
multi-paradim "freedom", whereas i find that multi-paradigm amounts to
NO paradigm, and integrating different people's code takes more
_programmer_ (human creativity) resources than writing from scratch.
this is bad.

for now i feel ruby walks this line very well. particularly with ruby
dividing defined chunks of procedural code into "blocks" and
discouraging count-looping with closures and functions like .each for
number objects.

thorough and intuitive thought such as this gives me sincere
appreciation for matz's design skills.
It's better to have all possible tools at-hand and to learn how to use them,
than to shun the ones you haven't learned to use effectively.

you sound like stroustrup.
imho, creating a unique tool for every job prevents the crafter from
learning to use any set of tools very well.
Sean O'Dell

-z
 
S

Sean O'Dell

out of curiousity, why?
or perhaps, how do you define "application"? (not to be pedantic, i'm
seriously questioning the concept of a monolithic application versus
combinations of utilities in the small single-purpose combined by IPC
unix sense.)

I think of an application as the point at which a group of related
functionality resides and is presented to the user or an external client
application through some interface, GUI or programmatic.

I didn't mean you can't compartmentalize all of your application components
into classes, modules and objects, just that it's not effective to connect
everything together through an OO structure. When objects interdepend too
much by trying to call each other for every possible task, I feel it breaks
the readability and maintainability of an application. It's usually more
effective, for me anyway, to keep the program objects more primitive, and to
use entry points (program load, event handlers, etc.) to do the actual work
of the application. I find it easier to find and fix code that way, and that
I write more reusable objects.
procedural programming defines top-down execution of _arbitrary_
instructions, and has little to do with modules/classes (which are OO
concepts).

Not modules and classes per se, you're right; but procedural programming uses
a concept of units which contain the scope of its variables. I meant modules
and classes as variable scope boundaries.
by how you are thinking of this, i could as well argue that functional
style is procedural because it follows the inputs and outputs of
functions.

Functional programming doesn't allow stateful variables, which procedural
would at various levels of scope.
the actual difference, however, is that both functional style and data
flow provide _context_ for when they operate and why. functional
style and data flow contain both sensors and effectors (as defined by
Cybernetics / Norbert Wiener); procedural style only provides
effectors and expects the omnicient programmer to design code like
deterministic clockwork. (Richard Dawkins probably deserves a mention
here as well.)

What are sensors and effectors in this context?
i suspect this is the heart of the issue behind the interest in
referential transparency and no side-effects. basically, the computer
should always know _why_ it's doing something and whether it worked
without depending on the programmer to know for it, unnecessarily.

I think people interested in functional language development are also
interested in tail recursion optimization and currying. Understanding what a
function does allows a language to morph the function itself, and the minimal
nature of functional programming makes it a good target for such features.
But I personally think when you're talking about this sort of thing, you're
talking about implementation candy, not really properties of the language
itself. You can have a functional language that doesn't optimize that way.
It's still a functional language.
i agree. this is why i advocate codifying flow-based programming as a
_style_ or "pattern language" of programming in ruby.

Aren't there already interfaces for CORBA and so on? I do this sort of
programming sometimes using stdio, believe it or not, and often remotely over
SSH. It would be a shame to design it in Ruby such that you couldn't take
advantage of non-Ruby components. Something universal like CORBA, or
XML-RPC, is good enough for me.
this is a fine line. i loathe C++ precisely because stroustrup favors
multi-paradim "freedom", whereas i find that multi-paradigm amounts to
NO paradigm, and integrating different people's code takes more
_programmer_ (human creativity) resources than writing from scratch.
this is bad.

I think the freedom isn't the only culprit; it's the sheer length of time C++
has been around, and how many programmers it attracted early on when
programming itself as a discipline was still a very mystic activity.
Nowadays, there are loads of design patterns to use as examples, so when a
bunch of new programmers jumps on a new language, like Ruby, it's a lot
easier to get them all cohesively communicating and using "approved" design
patterns.
you sound like stroustrup.
imho, creating a unique tool for every job prevents the crafter from
learning to use any set of tools very well.

I actually think Ruby gives you the ability to use MORE paradigms than C++
can, at least effectively. I felt far more boxed in with C++ than with Ruby.

Sean O'Dell
 
D

David Morton

Sean said:
I don't think you can restrict a language to just one of these paradigms
without narrowly restricting that for which the language can be used. Ruby
allows OO, functional, procedural, imperative and other paradigms because
they all have their uses at some point or other.

It's up to the developer to say "this application needs X% of this paradigm
here, X% of this paradigm there," etc. It's up to the developer to learn
what to use and when, and when to not. A person restricting themselves to
one set of concepts is a sign that they don't fully understand their
alternatives very well. Even globals and goto have their use, but a lot of
programmers don't fully understand them so they write horrible spaghetti code
with them, or disdain them completely out of fear.

It's better to have all possible tools at-hand and to learn how to use them,
than to shun the ones you haven't learned to use effectively.

Sean O'Dell

Well said. Anyone that says OO|Functional|Flow-Based|Procedural is the
"One True Way(tm)" probably needs to get out more and try to actually
use the paradigm in other fields. Academic discussions can be fun
sometimes, but the practical side of me knows that the real world isn't
so black and white. :)

I happen to like the way Ruby *can* handle being a simple procedural
language, but has *much* more power using other paradigms - use them
when appropriate. I personally use a hammer to pound nails, but I use a
screwdriver on screws. Use the right tool.

-
David Morton
 
Z

zuzu

Well said. Anyone that says OO|Functional|Flow-Based|Procedural is the
"One True Way(tm)" probably needs to get out more and try to actually
use the paradigm in other fields. Academic discussions can be fun
sometimes, but the practical side of me knows that the real world isn't
so black and white. :)

I happen to like the way Ruby *can* handle being a simple procedural
language, but has *much* more power using other paradigms - use them
when appropriate. I personally use a hammer to pound nails, but I use a
screwdriver on screws. Use the right tool.

-
David Morton


but some ways are better than others, and no code is an island unto itself.
the problem with stroustrup and C++ is that it tries to be everything
to everybody, and in the process does nothing to guide programmers
away from bad design. (like television programming which attempts to
appeal to every demographic, and so appeals to nobody because it's so
banal.) or in the real world, everybody tends to write C++ code their
own way, either at the personal level, or certainly at the
organization (corporate) level. the cost of path-dependency compounds
very quickly.

hammers for nails and screwdriver for screws, sure... but 95% of the
time a screw is better than a nail, and 99% of the time a philips-head
(+) is better than a flat-head (-). i don't need a "One True Way" for
100% of programming tasks, but so far no real "One Good Way" exists
for 90% of the programming people want -- and that's the processing of
lifestyle information, the data people struggle to keep track of in
their lives everyday. questions like "what's going on my computer?",
"how can i grab video from my webcam, compress it with mpeg-4, and
stream it to my friends, who i keep track of with a contact list, that
can also track their online status?", "how do i keep track of all of
my random brainstorms in a way that i can find them usefully later?"
(wiki has started to cover that one, long with everything2/tangle, and
some applied beyes). as i said, end-user programming -- what richard
m. stallman talked about when secretaries use emacs, or what alan kay
worked so hard on with squeak/smalltalk. the issue isn't to hide the
complexity of computers from people, but to refine it to be elegant so
that curious users can figure it out. (see Ted Nelson's 'Computer Lib
/ Dream Machines'.)

if you need to organize diverse software developers (themselves ad-hoc
and perpetually dropping in and out) around an evolving codebase,
where new developers can easily look at existing code and figure out
how to extend rapidly, it really helps to codify a style that
optimizes elegance, flexibility, readability, and intuition. (richard
stallman also discussed this problem with apprenticing new
programmers.)

in the real world, the amount of code written needs to decrease and
the number of people who can author code must increase. improvements
in language syntax and encouraged style, as ruby has taken amazingly
progressive steps forward with, make this happen. largely this is
ascribed to "the principle of least surprise", though i think it can
be enumerated by the blend of smalltalk, lisp, and perl design
principles. (some people also throw eiffel into that mix.)

programming is the expression of an idea into practice, and the gap
between how easy it is to think of an idea and how difficult it is to
articulate it in code needs to close. some days i feel like ruby cut
that distance in half. i think the actor / flow-based programming
style can cut that distance in half again.

leave obscure scientific programming in the rare position that
computing resources are more expensive than programmer thinking
resources to the few people really working on that. don't suffer
everyday programmers to write ten times the volume of code because
they *might* want to do something like that (they won't). (such
programming isn't sustainable anyway; mostly it's a one-off.)

i think we agree "use the right tool", but in designing a hammer we
don't worry that it'll suck at being a saw.

-z
 
Z

zuzu

I think of an application as the point at which a group of related
functionality resides and is presented to the user or an external client
application through some interface, GUI or programmatic.

I didn't mean you can't compartmentalize all of your application components
into classes, modules and objects, just that it's not effective to connect
everything together through an OO structure. When objects interdepend too
much by trying to call each other for every possible task, I feel it breaks
the readability and maintainability of an application. It's usually more
effective, for me anyway, to keep the program objects more primitive, and to
use entry points (program load, event handlers, etc.) to do the actual work
of the application. I find it easier to find and fix code that way, and that
I write more reusable objects.


Not modules and classes per se, you're right; but procedural programming uses
a concept of units which contain the scope of its variables. I meant modules
and classes as variable scope boundaries.


Functional programming doesn't allow stateful variables, which procedural
would at various levels of scope.


What are sensors and effectors in this context?

the sensors in functional programming would be the lack of stateful
variables, that how values are generated may be traced back up the
function chain. the same applies for "data flow" in flow-based
programming. unlike procedural code where memory values are
"mysteriously" overwritten with new values without any linking
rationale other than "the programmer told me to". effectors are the
"doing", the evaluation.
I think people interested in functional language development are also
interested in tail recursion optimization and currying. Understanding what a
function does allows a language to morph the function itself, and the minimal
nature of functional programming makes it a good target for such features.
But I personally think when you're talking about this sort of thing, you're
talking about implementation candy, not really properties of the language
itself. You can have a functional language that doesn't optimize that way.
It's still a functional language.

i find tail recursion and optimization as over-hyped, because
essentially they're a design detail of the interpreter, not the
language itself, as was already said by not me.
Aren't there already interfaces for CORBA and so on? I do this sort of
programming sometimes using stdio, believe it or not, and often remotely over
SSH. It would be a shame to design it in Ruby such that you couldn't take
advantage of non-Ruby components. Something universal like CORBA, or
XML-RPC, is good enough for me.

not for me. corba, and to a much lesser extent xml-rpc, seem complex
for complexity sake, to satisfy "enterprise level job security" or
something. find me a person who can implement corba themselves and
i'll concede this argument. even gnome only implements a subset of
corba for their orbs.
I think the freedom isn't the only culprit; it's the sheer length of time C++
has been around, and how many programmers it attracted early on when
programming itself as a discipline was still a very mystic activity.
Nowadays, there are loads of design patterns to use as examples, so when a
bunch of new programmers jumps on a new language, like Ruby, it's a lot
easier to get them all cohesively communicating and using "approved" design
patterns.

if you concede "approved design patterns", then i'm not sure why we're arguing.
i happen to feel that actor / flow-based style would be a positive
evolution in the "approved design patterns" of ruby.
I actually think Ruby gives you the ability to use MORE paradigms than C++
can, at least effectively. I felt far more boxed in with C++ than with Ruby.

which then essentially is my argument. by moving forward with "one
pretty good way", more people will be able to achive more real
productivity with less work. aka "less is more".
Sean O'Dell

-z
 
S

Sean O'Dell

i think we agree "use the right tool", but in designing a hammer we
don't worry that it'll suck at being a saw.

Just make sure both are in your toolbox, because you may need both.

Sean O'Dell
 
S

Sean O'Dell

not for me. corba, and to a much lesser extent xml-rpc, seem complex
for complexity sake, to satisfy "enterprise level job security" or
something. find me a person who can implement corba themselves and
i'll concede this argument. even gnome only implements a subset of
corba for their orbs.

For developers using CORBA or XML-RPC, it's pretty simple. You have to use
good libraries of course, not implement client/server code from scratch.
if you concede "approved design patterns", then i'm not sure why we're
arguing. i happen to feel that actor / flow-based style would be a positive
evolution in the "approved design patterns" of ruby.

I don't think we're arguing, just exchanging ideas. Just because this is the
Ruby ML doesn't mean every contentious exchange has to be an "argument." =)

I haven't found much to read on Actor/Flow-Based programming. I only saw one
brief page on it, but I couldn't figure out how it was different from
event-based client/server programming, which is, to say the least, some of
trickiest programming around.
which then essentially is my argument. by moving forward with "one
pretty good way", more people will be able to achive more real
productivity with less work. aka "less is more".

I disagree; more is more. It's good to cut away the really useless stuff that
causes more problems than it solves, like multiple inheritance, but there are
a heck of a lot of patterns that work, and I don't want to program in a
language that forces me towards one pattern.

Sean O'Dell
 
Z

zuzu

For developers using CORBA or XML-RPC, it's pretty simple. You have to use
good libraries of course, not implement client/server code from scratch.

ok, but could you easily figure out or write those libraries yourself
if you had to?

i feel the better method can expose all "black magic" programming to
the light of day so that a programmer wouldn't need to be an expert in
that to easily grok how it works and why.

(ruby's marshalling, for example, seems much more friendly and elegant.)
I don't think we're arguing, just exchanging ideas. Just because this is the
Ruby ML doesn't mean every contentious exchange has to be an "argument." =)

hehe, "this isn't an argument, it's just contradiction!" of course, i
didn't mean argument in the negative sense... "discussion" or what
have you. :D
I haven't found much to read on Actor/Flow-Based programming. I only saw one
brief page on it, but I couldn't figure out how it was different from
event-based client/server programming, which is, to say the least, some of
trickiest programming around.

well, i do not think the model need be "client/server", though from
looking over some initial reading of "event-driven programming" as
said before, it appears to be an earlier version in the evolution of
an idea. i think that once some design patterns are flushed out,
asynchronous messaging will be found much less tricky than synchronous
messaging. perhaps corba is an example of this. it also scales much
more freely across multiple processors both local (per my dual-G4
example) and across networks (collaborative software, distributed
computing, etc.) if programmers can learn to program in this style
well and can apply it in all of these situations, that seems a more
efficient use of creative resources -- more time manipulating data and
less time massaging the environment to be able to manipulate data.

http://www.jpaulmorrison.com/fbp/index.shtml
http://www.jpaulmorrison.com/cgi-bin/wiki.pl?FlowBasedProgramming
http://c2.com/cgi/wiki?ActorsAndFlowBasedProgrammingDiscussion
http://c2.com/cgi/wiki?ActorsModel
http://cliki.tunes.org/Actor
http://www.jpaulmorrison.com/fbp/cognates.htm
I disagree; more is more. It's good to cut away the really useless stuff that
causes more problems than it solves, like multiple inheritance, but there are
a heck of a lot of patterns that work, and I don't want to program in a
language that forces me towards one pattern.

not one pattern, but certainly a pattern language.
although i'm an advocate of multi-lingualism, when you need to
exchange ideas as we are doing here, it helps that we've all agreed to
do so in english.
better still would be to apply weakly true sapir-whorf hypothesis to
articulate in a language that optimizes our communication of ideas
with a minimum of time/reading. think of 'babel-17' (by samuel r.
delany) and its influence on matz in creating ruby.

http://en.wikipedia.org/wiki/Sapir-Whorf_Hypothesis

"more is more" becomes "How Much Land Does a Man Really Need?" by Leo Tolstoy

or, here's another way to look at why less is more. the fewer
possessions you own, the less you have to worry about keeping them
safe, maintaining them (even dusting), paying for the storage space,
mental cost of locating them, and so on. but there is a balance,
there will be tools you use quite often where their usefulness
outweighs their ownership cost over time. but many people acquire a
tool because they use it once, and after that it becomes a burden.
and if you re-use a tool in a slightly different way rather than
acquire a new tool for that unique task, you've learned to use that
original tool better.

in some ways this is what's nice about "everything is a function" with
functional programming. mucking things up with "operators" can be
more confusing than useful.
Sean O'Dell

-z
 
F

Florian Gross

Sean said:
You can have variables in a functional language, but what you can't have are
globals that act statefully, causing any functions you write to return
different values when passed the same parameter values. You can have
(pseudocoded):

As far as I know LISP does indeed have closures -- and I can emulate
globals with them in Ruby like this:

call_count = 0
define_method:)hello) do
call_count += 1
puts "Hello World ##{call_count}"
end
10.times { hello }

Guys with more LISP-experience than me should correct me in case I'm wrong.

Oh, and about not having side-effects: Most functional languages have
them when doing I/O.

Regards,
Florian Gross
 
S

Sean O'Dell

As far as I know LISP does indeed have closures -- and I can emulate
globals with them in Ruby like this:

Oh, and about not having side-effects: Most functional languages have
them when doing I/O.

I don't remember closures from my LISP days, but perhaps that's a memory
issue. I/O has always been an exception, but I think you have to have
exceptions to get variance into the program and I/O is a common programming
paradigm and a great way to introduce variance.

Sean O'Dell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top