User Name
Password
AppleNova Forums » Programmer's Nook »

OOP learning book with Ruby focus?


Register Members List Calendar Search FAQ Posting Guidelines
OOP learning book with Ruby focus?
Page 1 of 2 [1] 2  Next Thread Tools
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 10:17

I've been coding for years, and I have enough experience to pick up new languages easily, understanding the differences in syntax, features, etc. This all works really well for procedural programming.

...and there's the dilemma. It goes without saying that procedural programming is on the way out to make room for object-oriented paradigms. I understand very well that this isn't a choice by the people up there to deliberately make my life as a programmer hard, but that a lot of things, especially in a GUI, simply necessitate it, or, to say the least, make the resulting application lot more efficient.

When I write code, my brain has a workflow in mind. I could easily lay out the code as a flowchart instead, in OmniGraffle, for instance. It would be a graphical 1:1 representation. Trouble is: you can't do that with OOP. OOP isn't linera in any way; it doesn't follow the "this happens after that" or "under these conditions, this happens next" schemes at all. It's driven by events and other triggers, and while there may be micro-units where the same linearity applies, it just doesn't work that way for the entire app. It shouldn't. It wouldn't really work well that way.

But that's the way my mind lays it out, making me inherently incompatible with the concepts of OOP. No matter how much I understand them. I get what a class is, what an object is, what a method is and what messages are. But that still doesn't help me. I could continue as before and buy random books about this language and that language, or read tutorials or "electronic books" online. But no matter what, the stumbling block will always be the same: I don't think that way!

So what I need is a way to start learning to think different (hah). I don't much care for theory, so I'd much prefer to learn it by example, and since my most recent and perhaps most favored language is Ruby, there would be bonus points if it used that. (Preferably, no C++ and no Java; Objective-C, Python, C# and similar would be okay.)

So, any ideas? I realize this is a very… vague request, but if someone can think of something, that'd be great. Doesn't have to be a book.
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2006-01-25, 10:26

From my experience (Which is small, as it's limited to 3 years with PHP), OOP is still very much linear. There's no way to escape that with traditional computing abilities.

As for a book recommendation - I don't really know many books that lay out OOP...

There are very few books on Ruby on shelves as of yet, so you'll be hard-pressed to find one with a Ruby focus.

http://en.wikipedia.org/wiki/Object-...ed_programming is a Good reference on OOP, and I'd suggest reading it before purchasing anything.
  quote
kretara
Cynical Old Bastard
 
Join Date: May 2004
Location: The Hot, Hazey, Humid South
Send a message via AIM to kretara Send a message via Yahoo to kretara  
2006-01-25, 10:34

Chucker, I have the exact same problem.
I've been coding for years in Perl and do quite a bit of PHP in my current job. I've been trying to get my head around OOP and have had little success.
I have yet to find a book/tutorial that worked for me.
I'll be keeping close watch on this thread.
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-25, 10:35

No book recommendation here, but a suggestion.

When I start with developing Access database, which is in a weak sense, a OOB environment, I make decision on what I want to see on the screen, and what I can do at this point.

Here linearity applies.

Splash screen -> Main Form <-> Subforms (I think of them as subroutines) -> Data Integrity Checks and Error handling

Something like that. So instead of words, it's all about objects; but you still have to arrange it in a logical (e.g. linear) way so even an idiot can use it.

HTH
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 10:44

Well, it's good to see I'm not the only one with the problem All the more surprising that there seems to be no good resource for this. It's not the concepts I need to learn (there's plenty of information on that); it's the way of thinking, so to speak. I don't know how to put it any better. Ditching old habits and acquiring new ones, sort of.

Quote:
Originally Posted by rollercoaster375
From my experience (Which is small, as it's limited to 3 years with PHP), OOP is still very much linear. There's no way to escape that with traditional computing abilities.
In simpler applications, that may be the case, but as soon as you need to deal with, say, socket programming, you are forced to think of run loops, for example. Not that linear any more.

Quote:
There are very few books on Ruby on shelves as of yet, so you'll be hard-pressed to find one with a Ruby focus.
Eh, that's fine.

Quote:
http://en.wikipedia.org/wiki/Object-...ed_programming is a Good reference on OOP, and I'd suggest reading it before purchasing anything.
I did in fact look at that; they have a WikiBooks entry on that, too. Doesn't really help though. Again, it's not the concepts I'm trying to learn.

Quote:
Originally Posted by Banana
No book recommendation here, but a suggestion.

When I start with developing Access database, which is in a weak sense, a OOB environment, I make decision on what I want to see on the screen, and what I can do at this point.

Here linearity applies.
To an extent, yes. But what if the user does something in an order you didn't expect? The interactivity the user gains means, at the same time, that the programmer loses predictability.
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-25, 11:44

Ahh, yes.

That's why I always think about UI. I probably spend 90% of my time making decisions on how I want UI to work.

You already saw how Apple have a concise UI by generally having only one thing in one place, resistance against hidden contextual menus, and some more.

So for myself at least, I make decisions on what a particular screen is supposed to do, then wrap UI around that particular goal. The order shouldn't really affect how it will behave; only that certain conditions be satisfied before allowing one to moving on/returning to the starting point.

I looked at my old post and thought that my analogy was weak. I will try and post a flowchart of what I usually do when working on the database.

HTH.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 11:47

Quote:
Originally Posted by Banana
Ahh, yes.

That's why I always think about UI. I probably spend 90% of my time making decisions on how I want UI to work.

You already saw how Apple have a concise UI by generally having only one thing in one place, resistance against hidden contextual menus, and some more.
I'm very interested in UI design and Usability, but for me, that's entirely unrelated to code.

Quote:
I looked at my old post and thought that my analogy was weak. I will try and post a flowchart of what I usually do when working on the database.
Can't wait
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-25, 11:52

[quote=chucker]I'm very interested in UI design and Usability, but for me, that's entirely unrelated to code.[quote]

Well, with OOB, it *is* the code. At least I look at it that way.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 12:02

When you say OOB, you mean OODB, right?

Well, here's an example.

It takes me only about half a day to whip up a quick and dirty client for a network protocol, even in a language I barely even know. (I know, because I've done just that about half a year ago, with Ruby.) But, being procedural, the client essentially already has scripted in advance what it's going to do. E.g., I could write it to connect to the server, log in under a specific account, post some messages, then log back out. I could even give the user some degree of interaction through CLI arguments, e.g. let them customize the server, username and password. So far, so good.

The trouble comes when none of that is a given. What if the user only wants to run the client, but not actually connect to anything? What if the user wants to connect, but not log in? What if he wants to log in twenty minutes later? Then things aren't linear any more. And then I'm screwed, because I just can't program this kind of interactivity.

Does that illustrate the issue better?
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-25, 13:22

My 2c before I go to bed....

I'm not sure what you've got against java, its a great language and a great way to learn OOP principles... and there is a whole lot more documentation, courses, and books etc. than on cocoa/obj-c.

Now that being said... say you want to learn Obj-C, why not just start coding in it. It will come to you, and soon you will learn the ins and outs of instantiating objcets, methods calls, reusing objects, extending classes etc. trust me you will.

When I say "just start coding in it" I mean exactly that, dont worry if you are using procdeural or object oriented coding techniques... become familiar with an object oriented languages' syntax and the concepts will reveal themselves to you, thats how they do it with intro level java anyway. I recommend a program that tests for Palindromes as your next program following HelloWorld, that's what I've been using and it's just complex enough to be interesting, and give the language a bit of a workout.

If you are so inclined, you could always post your creations back here for critique.

I sincerely recommend java, I really do think the available resources for cocoa are sub-standard (this is my opinion), and if you are learning OOP, you should start on something where you can google it and get an answer... or post it here and have all the closet java programmers look at your code.

EDIT: Please dont get the idea I hate cocoa, I've been having some real fun coding for the Spider Solitaire X project (in cocoa) theres just been a couple of speedbumps here and there that have really bugged me because they came about from (IMHO) inadequate documentation.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 13:29

Quote:
Originally Posted by AsLan^
I'm not sure what you've got against java, its a great language
Too similar to C++. I just don't like it; matter of personal preference, simple as that.

For the record, I don't like ObjC that much either, but at least it has a use for me (creating OS X software). Java has no use to me. As far as I'm concerned, "runs anywhere" translates to "runs subpar everywhere". If I want something cross-platform, I prefer to use an uncompiled language, such as Perl, Python, Ruby, you get the idea. If I want something for Windows, I prefer to use a .NET language, and if I want it for Mac OS X, I can sort of understand ObjC code if I really have to. I prefer not to, however, if only for the need to manage memory.

Quote:
Now that being said... say you want to learn Obj-C, why not just start coding in it. It will come to you, and soon you will learn the ins and outs of instantiating objcets, methods calls, reusing objects, extending classes etc. trust me you will.
Trust me, that doesn't work for me. I still stick to my patterns which ultimately leads to an inflexible, non-modular application.

Quote:
I recommend a program that tests for Palindromes as your next program following HelloWorld, that's what I've been using and it's just complex enough to be interesting, and give the language a bit of a workout.
That's funny, since my first Ruby "program" was indeed a palindrome check. I had very little trouble designing it. However, that has almost nothing to do with OOP. It's very procedural.

Quote:
If you are so inclined, you could always post your creations back here for critique.
I get flamed enough as it is.

Quote:
I sincerely recommend java, I really do think the available resources for cocoa are sub-standard (this is my opinion), and if you are learning OOP, you should start on something where you can google it and get an answer... or post it here and have all the closet java programmers look at your code.
I'm sorry, but I'm not sure you really understand what exactly I'm trying to learn. I could learn Java if I were so inclined, but I would still approach it with a procedural idea, and that's just bad™.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-25, 13:38

Quote:
Originally Posted by chucker
I'm sorry, but I'm not sure you really understand what exactly I'm trying to learn. I could learn Java if I were so inclined, but I would still approach it with a procedural idea, and that's just bad™.
I understand exactly what you are trying to do :AllKnowingGrin:

You want to break your procedural habits and learn object oriented programming... you stated as much.

Here's a secret, that you hinted at before, object oriented programming starts out procedural. You dont think they jump into extending an class right after hello world do you ? although they do jump into methods which is a key part of OOP, if you are familiar with functions... you'll have no problems with it.

As for not liking java or obj-c, well... you have to start somewhere, and if you are wanting to learn, the cutting edge is probably not the best place to start (i.e. ruby, python). Start with a language that has well entrenched coding practices so you can learn the basics. Time spent learning java for the purpose of learning OOP is not wasted even if you have no desire to code java apps.

As for the palindrome example... this is what you need to do to make it object oriented, very simple... two classes:

Create one class for reading in user input and passing that input to the other class.

The other class evaluates the string passed and determines if it is a palindrome or not, then passes back a boolean.

The first class then informs the user on whether they typed a palindrome or not based on the results of the answer it got from the other class.

It is very similar to a function call, but it is object oriented.

I will be up for about another three minutes to see if you respond
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 13:48

I'm gonna respond, but I've already passed the three minutes, so good night.

For reference, here's the original palindrome code (here's hoping vBulletin, unlike WordPress, doesn't mangle it). It strips uppercase, spaces and the last character of a line, so it works with a lot of things. But it's not object-oriented. And your two-class approach doesn't strike me as particularly object-oriented either. After all, my code is already pretty much split in two (a procedure that returns the results of the check, and a main block that handles the input).

Code:
#!/usr/bin/env ruby def isAPalindrome?(text) puts text if text.downcase.delete(" ").chop == text.downcase.delete(" ").chop.reverse then return true else return false end end input = gets if isAPalindrome?(input) then puts "\""+input.chop+"\" is a palindrome indeed!" else puts "But no, it is not." end

Last edited by chucker : 2006-01-25 at 13:54.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-25, 13:50

Goodnight then... I really am going to bed this time !
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2006-01-25, 19:06

Quote:
Originally Posted by chucker
To an extent, yes. But what if the user does something in an order you didn't expect? The interactivity the user gains means, at the same time, that the programmer loses predictability.
Enter OOP: if the user does something unexpected, make sure that the methods you're using aren't overaccomplishing. By this I mean any time the user is presented with something, make sure that it's using a different method. In essence the code isn't a single linear line, it's multiple linear lines, starting from a single point.

That probably was a *terrible* explaination.

I understand what you're talking about though. Not in the strict sense however. Attempting to learn ObjC from my knowledge of PHP isn't easy, mainly because it's a paradigm shift - PHP handles each request with a fresh slate, ObjC doesn't (if you want to call them requests, that is).

I can see I'm not being of much help, so I'm going to go be quiet now ^_^
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-25, 20:10

After seeing how horrible my proto-flowcharts were, I did some research and came across this link. I think this will answer what you want to know.

Meanwhile, improvishing my flowchart.
  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2006-01-25, 20:15

First, let's try to define an object. Let's say an object is a collection of data and functions that work on said data. Let me try a simple example.

For my example, I will use book and library objects. The book will contain pertinent information about the book, and the library will be a collection of book objects.

So, a book object has the following data attributes:

BookName
ISBN
Author
Date
Publisher

The object will need gettor/settor methods to set/change and retrieve each data element from an object. For example a couple of book functions would be

public string bookName() {
return bookName;
}

public void setBookName(string bName) {
bookName = bName;
}

The idea behind OOP is encapsulation, everything related to an object is accessed through publicly defined functions. You don't just manipulate bookName directly, you use methods to get and set the bookName variable. The same applies to the other data elements, plus any object functionality you may add to the object.

Now let's move onto the library object. The library will contain a collection of book objects, because that's what a library is. But, in order to be useful, the library will need to keep track of whether or not a book is checked out, who checked a book out, whether a late fee is due. Also, a library will need to add newly purchased books to and removed damaged/destroyed/lost books from the library collection.

To do this, let's create a new inventory object. The inventory object contains the following data elements:

a Book object
inLibrary? boolean
dateDue (if not inLibrary)
lastCheckedOutBy (reference to person object)

Now the library object will have to manage the inventory collection.


I know you said you didn't like Java, but here's a library example I did in Java for a grant project in 2002 (paid for my 20GB iPod ). If you have any questions, I'll try to answer them, but it's been awhile. http://members.cox.net/pevac/ex8code.txt
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-25, 20:33

The reason why my flowcharts were so messed was that OOP inherently has a lot of recursive programming, as BassplayinMacfiend has said, there's a library for you to call upon.

However, I decided an outline would work better. Realize it's more of a pyrmaid, so as you work downward, you may have to branch out as if it was a nested loop, until it's satisfied, return to the question you left at and continue until all questions are answered.

Remember this is from my frame of reference of Access so I would want to check with other programmers to see if they can agree with the process.

Code:
1. what do I want on the screen? i. What do I want user to do there? 1. What can user input? 2. What conditions must be satisfied before user moves away? ii. What commands user can enter? (see 1.i.1) iii. What menu or options user can have? iv. What do I want the computer to do there? 1. What conditions should be satisfied before it loads? 2. What should computer know about it? (variables, objects, events) 3. Should computer monitor user’s inputs? a. What conditions should inputs satisfy? b. What actions should the computer take to accomplish the purpose? c. Should the computer prompt user for more details? i. Do I want the details on same screen or a new one? (if no, a new screen returns to 1 as a nested loop)
So in a nutshell, instead of thinking how to order your code, think how you want it to behave. Kinda like homebrewing a puppy of your own.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-25, 22:33

Quote:
Originally Posted by chucker
And your two-class approach doesn't strike me as particularly object-oriented either. After all, my code is already pretty much split in two (a procedure that returns the results of the check, and a main block that handles the input).
Perhaps, the Palindrome example seems pointless, but it can be split up into two objects, but perhaps it is not obvious.

How about a zoo, similar to baseplayingmacfiends bookshelf with books.

For whatever reason, you want to create a zoo object, and that zoo object contains animals, the animals all have a type etc. and reflect the basic animal attributes.

Let's start with the animal class...

Code:
public class Animal { //these following class variables make up our Animal object String name; boolean hasBeenFed; public Animal() // our default constructor... creates primordial ooze { name = "Primordial Ooze - why dont you subclass Animal"; hasBeenFed = false; } public Animal(String aName, boolean fed) // another constructor, for creating an Animal with custom specs { name = aName; hasBeenFed = fed; } public String getInfo() // a method (similar to a function) that returns a String built from this animals instance variables { if (hasBeenFed) { return (name + "and it is not hungry."; } else { return (name + "and it is hungry !"; } }
Okay... now we have an animal.... let's create a zoo to put it (and it's friends) too.

Code:
public class Zoo { Animal animalArray[50]; // we want 50 animals in our zoo, stored in an array public Zoo() // a constructor method to create the zoo object. { //use a for loop to seed our array with animal objects for (int i = 0; i < animalArray.length; i++) { animalArray[i] = new Animal(); // the "new" keyword in java instantiates a new object, calling its constructor method } } public static void main(String[] args) // this is a standard line in java for defiing your "main" method in java, the "main" method is called automatically at runtime. { Zoo myZoo = new Zoo(); // creates a zoo object and calls its default constructor, we created that above... for (int i = 0; i < animalArray.length; i++) { System.out.println( animalArray[i].getInfo() ); } } }
Okay... there we have a Zoo object storing 50 Animal objects in an array, the only problem is all our animals are hungry Primordial Ooze, which isnt too interesting.

Notice to get the information string from the animal we call the .getInfo() method... this operates like a
function but its specific to the object where we defined it.

To liven up our zoo we should subclass Animal into the different kinds of animals we want. A subclassed Animal needs to be defined like any other class but it will "inherit" the methods from the parent...

Code:
public class Tiger extends Animal { public Tiger() { super("Tiger", true); // this call to super will call the constructor in the "superclass" (Animal) and specifically will use the constructor that is looking for a String and a boolean (the one we didnt use before) } //no need to re-write the getInfo method, the Tiger object has inherited it }
and perhaps a Lion object too...

Code:
public class Lion extends Animal { public Lion() { super("Lion", false); // someone forgot to feed the lion } }
So now we have two kinds of animal, and some Primordial Ooze, because they are all derived from the Animal superclass, I can keep them in the Animal array. So now I modify the constructor in my Zoo object...

Code:
public Zoo() // a constructor method to create the zoo object. { //use a for loop to seed our array with animal objects for (int i = 0; i < animalArray.length; i++) { if (i % 2 == 0) // This says if the remainder of i divided by 2 is equal to zero.... { animalArray[i] = new Tiger(); } else { animalArray[i] = new Lion(); } } }
Okay now... we have a zoo, with 25 tigers and 25 lions... super

How does this develop into larger applications with EventListeners and GUI's etc... well all the elements of a GUI have already been created and encapsulated into objects. By knowing the syntax of the language and basic OOP principles, you can instantiate and use these GUI objects (IDE's can obscure this somewhat.. best to do it by hand first).
  quote
dfj225
Member
 
Join Date: Jul 2004
 
2006-01-25, 23:08

Since you mentioned you liked to use flow charts to help visualize and understand your programs, you might want to look into UML. UML tends to be used in a very informal sense by most programmers without them ever even knowing it. Ever seen a diagram with different boxs linked by arrows that represented the design of a program? That could be considered very, very basic UML.

One concept that seems to have always helped me design OO code was to think about what logical objects could be created in my design. The basic idea is that an object will encapsulate everything that it should logically represent: the data that it is relevant to it and the methods that operate on this data or present it to the user. I think encapsulation is the key area to concentrate on when starting with OOP. Once you start to see how to use a class to represent an abstract idea, it will probably become easier to see how to string together operations on objects to create an entire program.

Something else to consider is the study of design patterns. The most famous book on this topic was written by the Gang of Four and is called, simply enough, Design Patterns. The idea here is that problems that are common in software engineering can be abstracted into reusable classes. I'm not sure that this would be a good place to start when just learning OOP, but once you get framiliar with it, this book will really be able to show you some of the benefits of OOP. The GoF book may be a bit dated, but the information it contains is still very vaild. If you prefer a book that is on the same topic but is more recent, just searching for design patterns should get you on your way.

I wish you good luck wrapping your head around OOP. I remember that I initially struggeled with the transistion, but luckly I was able to learn it early in my studies. In the end, OOP really is just a stylistic difference from functional programming -- anything that can be accomplished one way can be accomplished using the other. Just don't give up and keep reading as much as you can on the subject and hopefully it will become second nature soon enough.

--Edit--
One thing I forgot to mention: I would suggest learning OOP using Python. In Python, everything is an object yet you can still code in a procedural way if you like. However, once you start to understand OOP, the language will unfold before you. I don't have much experience with Ruby, but I understand it has a similar approach. So I suppose either language would be a good choice.

Last edited by dfj225 : 2006-01-25 at 23:14.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-25, 23:40

Quote:
Originally Posted by Banana
After seeing how horrible my proto-flowcharts were, I did some research and came across this link. I think this will answer what you want to know.
Thanks, reading.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-26, 00:26

From http://www.developer.com/design/article.php/3317571 :
Quote:
The fundamental advantage of OO programming is that the data and the operations that manipulate the data (the code) are both encapsulated in the object. For example, when an object is transported across a network, the entire object, including the data and behavior, goes with it.
Um, what?

Let's try and play this out practically. Let's say I have a C++-compiled program as the client, with some data, and it encapsulates that in an object.

On the other end, I have the server, which might be written in, say, Java. It then receives the object.

How the heck does that work? How could a Java server understand the behavioral annotations in the object? Sure, if you were to come up with some language-agnostic format for describing behaviour, say, XBL, and wrap it in that. But that's not what the article is saying.

The author seems to imply that you could transmit the methods of an object as part of the object. I would argue that's impossible.

Anyone care to clarify?
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-26, 00:38

Wouldn't that be an example of APIs?

Access developers share their codes all time. There's a library of commonly used codes that you could load in your own project.

So instead of having to redraw "Ok" dialog boxes you just use the one that's already out there.

I'm not sure whether it's multi-lingual, though but then agian, *nix can use different flavors' library, provided that they are re-compiled.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-26, 00:46

Quote:
Originally Posted by Banana
Wouldn't that be an example of APIs?
Not in the way the author has worded it, at least nto to me.

Quote:
So instead of having to redraw "Ok" dialog boxes you just use the one that's already out there.
Sure. But the way I read this is that an object is transmitted between two network peers (a client and a server), and that that object includes both data and behaviour. How do you define behaviour? Wouldn't behaviour be a set of methods? Accessors/getters/setters?
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-26, 01:00

Now that I've read it second time, I realized I wasn't thinking the same thing.

You'll need to ask someone else; right off the top of my head is that with OO environment, you could wrap objects' behavior into the object (e.g. the black box), and give client the black box, so you know that the client's end will behave exactly the way you want it to as the black box brings with it its attributes.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-26, 05:41

Actually, the article is just wrong.

Object oriented programming doesn't involve encapsulating objects and sending them across the wire to other programs for processing (although that is possible if you were to design client/server applications to facililtate it, you wouldn't send "objects" through the wire though, you'd send data and it would be reassembled into an object by the receiver). The example they used of a "web object" is just wrong... the java applet is a fully functional application that just happens to run inside a browser it can only run if you have java installed, your java environment is set up, and your browser properly configured. The fact that java is an object oriented language has nothing to do with transmitting or running java applets.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-26, 05:51

Upon consulting my java network programming book... it appears there is something called RMI (Remote Method Invocation) which apparently allows a program to access methods of objects across the wire. And something else called CORBA which lets objects written in different languages communicate with each other.

This is definately beyond the scope for an introduction to OOP, or even an introduction to whatever programming language you plan on using (and actually CORBA is beyond the scope of my book too).

Perhaps you should go to the library and see if they have any books that explain it properly

Last edited by AsLan^ : 2006-01-26 at 05:59.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-26, 06:04

Quote:
Originally Posted by AsLan^
Actually, the article is just wrong.
That's what I figured, sadly, which is why I asked.

Quote:
Originally Posted by AsLan^
Upon consulting my java network programming book... it appears there is something called RMI (Remote Method Invocation) which apparently allows a program to access methods of objects across the wire. And something else called CORBA which lets objects written in different languages communicate with each other.
I've heard of CORBA, but not of RMI.

Quote:
This is definately beyond the scope for an introduction to OOP, or even an introduction to whatever programming language you plan on using (and actually CORBA is beyond the scope of my book too).

Perhaps you should go to the library and see if they have any books that explain it properly
Agreed. Well, I did order a book which a friend recommended to me; the first edition of this. I won't be able to read it for a while, however.

So in the meantime, I'll continue to try and find a decent non-printed introduction

Last edited by chucker : 2006-01-26 at 06:53.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-26, 06:35

You might get something out of this A Gentle introduction to OOP

It only takes about five minutes to read (2 pages) and I found it on the Smalltalk website.
  quote
chucker
 
Join Date: May 2004
Location: near Bremen, Germany
Send a message via ICQ to chucker Send a message via AIM to chucker Send a message via MSN to chucker Send a message via Yahoo to chucker Send a message via Skype™ to chucker 
2006-01-26, 07:05

Well, that was a nice read, thanks. I guess reading it with fresh analogies was kind-of-helpful.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Page 1 of 2 [1] 2  Next

Post Reply

Forum Jump
Thread Tools

« Previous Thread | Next Thread »

All times are GMT -5. The time now is 19:44.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2019, AppleNova