It's called the Uniform Access Principle[1] and the languages that don't take advantage of it often suffer from a getter/setter hell.
Hey presto! Now you have the best of both worlds.
I disagree. Code execution is not data access. They are very separate concepts.
Whether you like that or not is immaterial. You are free to avoid that aspect of OOP or the paradigm altogether.
For example,
class flower
property color
property numberOfPetals
method pluckPetal()
method water()
A property defines data about an object, and a method defines something you can 'do' with the object.Could you give some pointers to the OOP principle that blurs the line between these two?
There are languages where UAP is enforced by the syntax (eg. Eiffel, Smalltalk, Ruby) and languages where it's a matter of convention. But even in the latter it's considered a good practice to keep properties private and encapsulate them with accessors. Some even have dedicated features that help with that (auto-properties in C#, properties in Python).
There is absolutely no reason for that, and the grandparent of all things object-oriented (Smalltalk) very strongly disagrees with you: everything is a message, and there are no properties.
> A property defines data about an object, and a method defines something you can 'do' with the object.
A getter method is a property and a method. Properties are irrelevant, access should be uniform, the implementation details of an object (whether a "property" provides direct access to internal data or not) is of no concern to the user of the object.
A property is nothing more than a method whose contract is "give me some data"
However, for me, and the CPU, we treat code execution differently to data access.
1. It's not ugly
2. It's how CPUs work
3. It's how most people think
2. If you want a programming language that maps closely to how CPU's work, Ruby's definitely not for you. Assembly and C are for you.
3. I can't speak for most people. What I can say is that I can think in C and I can think in Ruby, and it doesn't seem difficult for me.
I would point out, however, that printf is fairly rarely used and that I am not familiar with fincher.org in the context of sites to recommend newbs to learn Ruby from.
Removing the difference between accessing an attribute (variable) and invoking a method is a solid OO principle. You, as a client of the API, should not care how obj.foo is implemented.