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 2 of 2 Previous 1 [2]  Thread Tools
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2006-01-26, 08:38

Quote:
Originally Posted by chucker
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.
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?
Hey, that's what I said in my earlier post:

Quote:
Originally Posted by bpMF
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.
I'm glad some of this stuff stuck in my head.

As far as RMI / CORBA goes, it is possible to serialize an object, transmit to a local or remote receiver who can then unserialize and use the object. In order for this to happen, you have to build an interface and an object that implements said interface.

This way, the interface (which is just a description of data and functions, like an Obj-C header file) can tell the receiver how to work with the serialized object it just received. It's really cool, and some languages like Obj-C and Java make it pretty simple to add this type of functionality to your objects.
  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, 08:44

Quote:
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.
No, I totally get that part. That's nothing new to me. The idea, however, that this encapsulation can be transmitted not only over the network, but also across entirely different languages, seems absurd to me.

I understand now that the author was talking about a unified, mostly language-agnostic means such as CORBA.

It's not a feature of OOP per se, so I don't think the remark belonged in that document. Oh well.
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-26, 09:10

As^Lan,

I'm just curious- Would you agree that OO programming is all about seeing? That is, what you see is what influences how program will work?
  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2006-01-26, 09:13

Quote:
Originally Posted by chucker
No, I totally get that part. That's nothing new to me. The idea, however, that this encapsulation can be transmitted not only over the network, but also across entirely different languages, seems absurd to me.

I understand now that the author was talking about a unified, mostly language-agnostic means such as CORBA.

It's not a feature of OOP per se, so I don't think the remark belonged in that document. Oh well.
I agree. You need to learn the basics of OOP before you start delving into network stuff, serializing objects, etc. You can build tons of programs in OOP without ever opening a network port, so it does seem far beyond a basic description of OOP.

If you're interested you could download the source to my Musical Scales program from the link in my sig. I'm not sure how readable the code is for other people (I can read it ) but it may give you an idea of how OOP is used if you look at the usage of the Note and ScaleGenerator objects and how they're referenced by the main program object (forget the name of that one : ).
  quote
Mr Beardsley
Member
 
Join Date: Jul 2004
Location: Colorado Springs
Send a message via AIM to Mr Beardsley  
2006-01-26, 10:54

Whoever said you need to just start coding in OO is 100% correct. It's not like you get the concepts of OO and can then whip out perfect OO designs. It takes a while to know what to put in the various classes. I heartily recommend that since you are using a Mac you use probably the best OO framework around, Cocoa. It won't take long for you to get the hang of it. The simple act of reading data from and sending data to textfields, along with changing the state of buttons will have you thinking OO in no time.

[button doSomething];
myData = [textField giveMeMyString];

etc...

"Slow vehicle speeds with frequent stops would signal traffic congestion, for instance."

uh... it could also signal that my Mom is at the wheel...
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-26, 15:34

Quote:
Originally Posted by Banana
As^Lan,

I'm just curious- Would you agree that OO programming is all about seeing? That is, what you see is what influences how program will work?
Perhaps I'm not sure what you mean but, no I don't thing OOP is all about "seeing". OOP is about segregating your program into managable chunks which can be re-used (optimally).

As far as "seeing" is concerened, I think you might be talking about the Model, View, Controller approach to coding with an object oriented language. In my latest project I have attempted to implement MVC but I'm not sure I would do it differently if I weren't purposely trying to separate the MVC.

I subscribe to the top down approach to programming where I start with a basic vision of how I want my program to operate and refine individual parts of the program. I find object oriented programming really facilitates the top down approach, there is nothing in OOP that couldn't be constructed in BASIC with meticulously designed GOTO's but the OOP paradigm definately helps my workflow, allows me to reuse my code (and others i.e. JFrame), and basically just makes sense to me. Like I was saying to ahdustin yesterday, when I first learned about classes and objects, the first thing I wanted to do was build a zoo full of animals, I wasn't sure what they would be doing but I just pictured them running around doing their own thing.

I later learned how to write programs that acutally did something (its debatable whether my programs are useful or not ) and I wanted to reinforce Mr. Beardsley's point for others (chucker already ordered a book) who might be reading this thread. Good OOP design doesn't necessarily come from reading a book or following a tutorial, it comes from writing programs, resolving problems that come up (and they do), and accounting for those contingencies in your next programs. To do this, you need to be familiar with an object oriented programming languages syntax (just being an expert on OOP doesnt mean you can code any language without study and experience), and you need to push that language and do the things you know it can do.... start with console output, if you feel like you can handle it, move to GUI... start including event listeners in your programs etc... when you play around with these things enough, the object oriented principles reveal themselves to you, you subconciously know that if you dont put those methods into a class of their own then it will mean more work for you later, so... you do it
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-26, 17:38

As^Lan, thanks so much for your view-

It does sounds like either 1) I'm mistaken about what I know, 2) I have a different paradigm in mind.

See, I had a seminar years ago that was basically to introduce freshmen to computer science and they had us play with Visual Basic (blech), saying it was a example of OOL,

Forward to recent past; at my work, they need a database and I was willing to do it for them so I use Access (double blech), which uses Visual Basic modules and other features.

So when I'm working on the forms, I am basically programming what I want to be on the screen, so if I add a button, (mind you, I do it with wizards disabled, thankyouverymuch) I place it where I want it, size it, give it a name, then Visual Basic Editor opens up and I type in code I want this particular button to execute.

So to me, it's all about what I see on the forms, ensuring that I have covered all possible/necessary events so the database will behave exactly the way I want (e.g. checking whether records are filled in before moving on to the next one, ensuring that data is consistent across the record, etc. etc.)

Does that make sense now?
  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2006-01-26, 20:55

Quote:
Originally Posted by Edsger W.Dijkstra, 18 June 1975
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.


I like this quote the best though:

Quote:
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.
Yes, we still have COBOL programs as part of our daily data movement.
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-26, 21:07

Quote:
Originally Posted by Originally Posted by Edsger W.Dijkstra, 18 June 1975
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.


I guess I'm in deep doo doo and even worse off than Chucker.
  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, 23:25

Actually, I started out with BASIC on a Commodore 64 when I was six. Maybe fundamentally, that's my problem.
  quote
AsLan^
Not a tame lion...
 
Join Date: May 2004
Location: Narnia
 
2006-01-26, 23:37

Quote:
Originally Posted by Banana
As^Lan, thanks so much for your view-

It does sounds like either 1) I'm mistaken about what I know, 2) I have a different paradigm in mind.

See, I had a seminar years ago that was basically to introduce freshmen to computer science and they had us play with Visual Basic (blech), saying it was a example of OOL,

Forward to recent past; at my work, they need a database and I was willing to do it for them so I use Access (double blech), which uses Visual Basic modules and other features.

So when I'm working on the forms, I am basically programming what I want to be on the screen, so if I add a button, (mind you, I do it with wizards disabled, thankyouverymuch) I place it where I want it, size it, give it a name, then Visual Basic Editor opens up and I type in code I want this particular button to execute.

So to me, it's all about what I see on the forms, ensuring that I have covered all possible/necessary events so the database will behave exactly the way I want (e.g. checking whether records are filled in before moving on to the next one, ensuring that data is consistent across the record, etc. etc.)

Does that make sense now?
I see what you're saying

But isn't your program more dependant on the database than the form ?

I mean, the form doesn't define the database... you already have a database with fields that need to be filled, so it's the database dictating what goes on the form.

Your particular case doesn't sound particularly object oriented (although you may be using an OO language) especailly if you are re-typing the methods for each button (assuming that there is some redundancy going on). But I can't really say that without seeing the code or having intimate knowledge of your program.
  quote
Banana
is the next Chiquita
 
Join Date: Feb 2005
 
2006-01-27, 00:01

Database itself is stored in tables, queries.

Forms are the one that user interacts with to store data. Whatever I discussed here were relevent only to my work in forms.

Yes I don't work with building a program from ground up, but I do get to define how a error message should read, what buttons there can be, how the database should behave, etc etc.

They call it "Visual Basic Modules." Not sure if it's meaningful to you, but that's what they call it.

WRT redundancies, there are pre-defined codes for common commands (e.g. closing a form) that loads automatically. However, I usually hand code in custom commands if I need some conditions to be satisfied.

Hope that gives a clearer idea.


Chucker, we're in same boat; I grew up with Commodore 64.

Best computer system evar.
  quote
bassplayinMacFiend
Banging the Bottom End
 
Join Date: Jun 2004
 
2006-01-27, 16:46

Quote:
Originally Posted by chucker
Actually, I started out with BASIC on a Commodore 64 when I was six. Maybe fundamentally, that's my problem.
I traded my TI99/4A to my buddy for his C-64. He really liked a dungeon game I had for the TI.

[edit]
BASIC for the C-64 was created by MS.

Last edited by bassplayinMacFiend : 2006-01-28 at 15:31.
  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 2 of 2 Previous 1 [2] 

Post Reply

Forum Jump
Thread Tools

« Previous Thread | Next Thread »

All times are GMT -5. The time now is 00:24.


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