Syntactic Confectionery Delight PerlMonks

### Re: The world is not object oriented

by exussum0 (Vicar)
 on Jan 02, 2004 at 16:12 UTC ( #318339=note: print w/replies, xml ) Need Help??

in reply to The world is not object oriented

1.
Day and night are objects of type time of Morning. Think of it like a Boolean, where it's true or false. Or something like that. :)

But you are right. Everything isn't an object. Anything that's physical can be represented as an object. Things that follow ideas usually can be, such as Calendar Date is comprised of a Month, Year, etc... SOme things can be but shouldn't, such as some parsers, where functional programming would be a little smarter.

2.
Nono. Programs are a tool to solve real world problems. If it's adding two numbers to solving pi to the 80th digit, yeah. But processes solve problems. The process of adding and pi are easily implemented as programs. There are a set of problems which cannot be solved in deterministic time. The halting problem for instance: If a given set of code will ever end. That is much easier to do for a human (right now).

3.
Part of the problem with a computer is, it's binary.. usually. It cannot represent some states easily. We can simulate it with tons of statistics, but that's as far as it goes. Expert systems accomplish things like this with prior inputs and confidence levels, which are just statistics. Same with spam, and baysian filters.

4.
Everything can be represented as an object. Data can always be represented by a graph. Sorting can always be implemented w/ an n log n algorithm. But it's not always the best representation.

Figuring out the relationships of how things fit isn't hard. It's preparing for the future that is hard. Simple patterns of usage in a current system is quite easy when you know what's going in. It's just tedious. Given a set of functions of a program, it can be segregated into a many different subsets, where things overlap. But solving a real world problem doesn't require knowledge of all subsets.. just the best ones. Problem is, when someone throws a fork into the mix.

Everything can be done with OO in one form or another. Not always great, not always terrible, but it can be done. Should it? No.

But the definition of OO is clear. It's simply a description of what something can do and what attributes it has. How the definitions of the "do's" and "attributes" are, how they are passed around, accessed and all, is both a sugar and a medicine. It makes things easier and enforces "good" patterns of usage. Java doens't do multiple inheritance for it's "good reasons". perl and c++ do. perl and php (till late) had no access modifiers.

OO appeals to orgnaized people. Not all the people it appeals to are organized and some organized people think OO is not that great.

People who write algorithms, like solving sorting issues and what not don't always flock to OOP since you are describing a process in it's simplest forms. Even then, it's not usually in a concrete language in its description, but in functional psuedo-code :)

Play that funky music white boy..

Replies are listed 'Best First'.
Re: Re: The world is not object oriented
by hardburn (Abbot) on Jan 02, 2004 at 16:53 UTC

Day and night are objects of type time of Morning. Think of it like a Boolean, where it's true or false

As tilly pointed out, "day" and "night" are not boolean. It's clear that 3:00 AM is night, and 1:00 PM is day, but conditions around twilight become difficult to seperate night and day. In fact, you can take mesurements at the same lattitude but different logitudes and get different values for night and day (even ignoring the Earth's tilt), because higher spots will see the sun longer, and lower spots might be obscured by mountains.

IMHO, these boundry conditions are too often ignored as "noise" in mathmatics and science. It wasn't until the study of Chaos theory and fractals that people started realizing just how facinating boundry conditions really are.

the definition of OO is clear

The only "clear" definition of OO is so broad that it becomes useless in practice. Too many people think different ways on OO. Which is one reason I like Perl--it allows many different object systems to coexist and lets you pick the best one.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

I dedicate this post to you, since it's my 100th writeup :)

Well, I usually say good morning until noon, and refer to 3 in the morning when people call me that late/early.. but we can always say it's an object type BeforeNoon, but we can quible on that, since AM and PM doese have some sorta binary meaning.

The only "clear" definition of OO is so broad that it becomes useless in practice
I strongly disagree with this. The most freeform language you can have is machine language. All the higher level languages do is impose a syntax and laws of use. For instance, I've worked at companies where this_is_a_function vs thisIsAFunction was enforced. WHere tabs and spacing are dictated. This is to make things easier to read. Yes, we can argue that once you know a language it should be easy, but that's not the point.

All languages like java, php, perl, c++ and even c do, is dictate how OOP can and can't be usd. in C, it's the most liberal, since you can use OOP by emulation with structs. php and perl are of varying amounts of freedom. Java is very strict. In the broadest, most liberal sense, it's still quite useful. If you impose coding standards on it which govern usage, you come up with your own language where certain things aren't allowed. Even perl can be made to emulate java by never using multiple inheritance. Define an interaface by having all your methods as die().

It's a reason why there are a lot of people use java for oop and perl for oop. A lot of people agree that java's restrictions (permissions and usage) for how clases work is better than most. The perl people like the freedom they have. It's why languages strive, people agree on stuff :) So you see, the practical ones that people like, such as perl's, php's, java's, c's (lack there-of or via struct-emulation) is clear for them and thus highly usable.

Play that funky music white boy..

All languages like java, php, perl, c++ and even c do, is dictate how OOP can and can't be usd.

No, they provide the syntax for doing OOP. Java, for instance, allows you to make a class definition that is nothing more than publically-accessible attributes. Such a class uses Java's object syntax, but it isn't really an object. It's a data structure. If what you need is a data structure, that's fine, but don't call it an object just because it's syntax makes it look like one.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

: () { :|:& };:

Note: All code is untested, unless otherwise stated

All in good fun :)

I usually say good morning until noon, and refer to 3 in the morning when people call me that late/early.

See, now you are half-contradicting yourself! You say you refer to it as morning, then you go on to say that it is both early and late. So is "January 3, 2003 at 3 AM" January 2nd's late night or January 3rd's early morning? Technically, it is January 3rd's early morning, but human perception and thinking comes into play. Even the simplest things can become confusing, because all it takes is one person who thinks differently than the majority of others.

Create A New User
Node Status?
node history
Node Type: note [id://318339]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2018-01-21 12:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How did you see in the new year?

Results (228 votes). Check out past polls.

Notices?