Object oriented does not mean class oriented

R

rolo

Hi all,

I see for every class i declare, it is basically a new object extending the class object.

class MyClass < BaseClass

end

I think apart from class, I should be able to declare many other constructs like Bean etc.

so class declearations are something like this

Class.new("MyClass","BaseClass") {
method.new("MyMethod"){

}
}

But for ease of reading and declearations we use the present ruby form.

How wonderfull it would be if we can define Bean like that:

Bean MyBean < BaseBean
attributes :name
end

I know we can do this in the current ruby. But it would be better if we switch to something like this.

Class MyClass < BaseClass
end


regards,
rolo

"There is always more to say"
http://www.c2.com/cgi/wiki?EasternPhilosophyInSoftwareDesign
 
D

Dan Doel

I'm not sure I understand your proposal.

How is Bean different than a class? What makes

Bean MyBean < BaseBean

different from

class MyBean < BaseBean

? Or is it a matter of being more specific in the naming (e.g. you know
whether you're defining a regular Class or a Bean class)?

Could you explain a bit more?

- Dan
 
F

Florian Gross

rolo said:
Hi all,
Moin!

But for ease of reading and declearations we use the present ruby form.
I know we can do this in the current ruby. But it would be better if we switch to something like this.

I'm not sure if I understand you correctly, but these two things are
very possible already in the current Ruby:

1) MyClass = Class.new(BaseClass) do
define_method:)foo) do
puts "hello"
end

def bar
puts "world"
end
end

2) def Bean.new_class(&block)
Class.new(Bean, &block)
end

MyClass = Bean.new_class do
def a; end
define_method:)b) do; end
end
regards,
rolo

More regards,
Florian Gross
 
R

Robert Klemme

rolo said:
Hi all,

I see for every class i declare, it is basically a new object extending the class object.

class MyClass < BaseClass

end

I think apart from class, I should be able to declare many other constructs like Bean etc.

so class declearations are something like this

Class.new("MyClass","BaseClass") {
method.new("MyMethod"){

}
}

But for ease of reading and declearations we use the present ruby form.

How wonderfull it would be if we can define Bean like that:

Bean MyBean < BaseBean
attributes :name
end

I know we can do this in the current ruby. But it would be better if we
switch to something like this.

What do we gain by this? What is it that you want to achieve?

robert
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top