HomeStoreForumsWikiiPhone Native AppsiPhone AppsiPhone Apps modmyifone Downloadsmodmyifone Links






Go Back   ModMyiFone.com - iPhone | iPod Touch forums, news, apps, themes. > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Register FAQ Members List READ THIS Today's Posts Mark Forums Read

iPhone / iPod Touch SDK | Development Discussion SDK questions. A place for iPhone developers to post code snippets, discuss creating iPhone apps, and any other iPhone developing.


iPhone Optimized MMi | Browser Optimized MMi

Get more out of ModMyiFone by joining our free community. By registering you get privileges to download files from our downloads section and you may also post your questions in our forums! It's fast, free, and easy!

Opportunities at MMi | 1.1.4 Unlock|Jailbreak OS X / Win
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-2008, 06:58 PM
DoerrFan's Avatar
Livin the iPhone Life
 
Join Date: Jul 2007
Location: Massachusetts
Posts: 1,363
Thanks: 47
Thanked 232 Times in 156 Posts
Send a message via AIM to DoerrFan
Explain Object Oriented Programming.

Could someone give me a hand to explain OOP? Im ordering the iPhone Open Application Development written by NerveGas, but its out at Amazon so i have to wait and i just want to get a feel for it before. I've read a little about it already though, just need a few layman terms for it. Thanks!
__________________
Like what i said? Hit the Thanks Button!
1.83GHz MacBook 160GB HDD 1GB RAM
3.06GHz iMac 320GB HDD 2GB RAM

SEARCH BEFORE POSTING
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2 (permalink)  
Old 03-28-2008, 11:39 AM
JLA JLA is offline
Developer
 
Join Date: Oct 2007
Posts: 198
Thanks: 1
Thanked 20 Times in 19 Posts

An object is like a struct, except that it also has methods. C doesn't have this capability, but C++ and ObjC do. Having methods grouped this way makes everything a lot cleaner and easier to deal with.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3 (permalink)  
Old 03-28-2008, 04:10 PM
NetMage's Avatar
Developer
 
Join Date: Aug 2007
Device + Firmware: iPhone 1.1.3
Operating System: Windows XP
Location: Virginia
Posts: 982
Thanks: 26
Thanked 161 Times in 134 Posts

Wikipedia is good: http://en.wikipedia.org/wiki/Object-...ed_programming

I'm not sure OOP is as important as event-driven programming for iPhone development, but here is a go:

Object-oriented programming means developing your application by designing its processes by modeling the interactions of simulations of "real" (concrete) items. These in-computer representations of items are called objects.

Objects consist of some data (state) and procedures (called methods) that operate on the data. The classical example is a money management program. Your program needs to model accounts, which have state information (such as account balance and institution) and operations (such as Deposit or Withdraw).

Objects are (typically) instances of classes, which are like recipes that describe the data and methods of the objects. You can have multiple objects that all belong to the same class, each with different data values (different account balances) but all having the same type of data. Classes (typically) belong to an inheritance hierarchy, that let's a particular class be described by its differences from a base class, rather than each class being independent. For example, you could have an Account class, and then CheckingAccount and SavingsAccount classes with specialized information (number of checks written this month, etc).

Objects data is typically scoped so that it can not be accessed from outside the object, forcing the consumer to manipulate the state through the provided methods. Similar to the relational model of databases, this isolates the internal state and functioning of the object through a public API (its public methods) which allows changes to be made in the private functioning of the object without affecting consumers.

To make this easier, objects can have properties, which look like direct access to state from the consumer's point of view, but are mediated through methods from the class designer point of view. For example, a Temperature object could have a double value to hold its temperature in degrees Kelvin, and properties that represent the temperature in Celsius, Fahrenheit and Kelvin. Setting the Kelvin property which just store the new value. Setting the Celsius property would convert the Celsius value to Kelvin, then store that value. Similarly, reading the property would do any necessary conversion and return the appropriate value.

Changing the Temperature object to store Fahrenheit instead would mean changing the method definitions in the objects, but a program that uses the object would be unaffected. This encapsulation encourages programming in small, understandable chunks and decrease coupling across separate program concerns, allowing independent development and testing or just independent focus when programming. It is also part of the basis for Brad Cox's concept of the "Software IC" where off-the-shelf software components could be combined together to create working applications.

For some concrete iPhone examples, the on-screen controls that you interact with such as buttons on the keypad, are represented in the program by instances of a UIButton class that understands how to interpret contact with the screen as a button press, respond by highlighting itself on the screen, and sending a message (calling a method) to the object delegated to care about the button press.
__________________
Starlight Computer Wizardry
Pocket-sized Development
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4 (permalink)  
Old 04-04-2008, 07:35 PM
DoerrFan's Avatar
Livin the iPhone Life
 
Join Date: Jul 2007
Location: Massachusetts
Posts: 1,363
Thanks: 47
Thanked 232 Times in 156 Posts
Send a message via AIM to DoerrFan

Wow! Great thanks for the help!
__________________
Like what i said? Hit the Thanks Button!
1.83GHz MacBook 160GB HDD 1GB RAM
3.06GHz iMac 320GB HDD 2GB RAM

SEARCH BEFORE POSTING
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  ModMyiFone.com - iPhone | iPod Touch forums, news, apps, themes. > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion


Thread Tools
Display Modes

Posting Rules
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
Trackbacks are On
Pingbacks are On
Refbacks are On

ModMyMoto.com - ModMyGPhone.com - ModMyiFone.com - Managed Dedicated Servers by SingleHop - iPhone Wallpapers - Contact Us - Link to us - Archive - Privacy Statement - - Top
Copyright © 2007-08 by ModMy, LLC. All rights reserved. You may not copy anything on this site unless you link to the original.
All times are GMT -6. The time now is 10:08 PM. Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
ModMyiFone.com is an independent publication and has not been authorized, sponsored, or otherwise approved by Apple, Inc or Cisco Systems, Inc. The information contained on this site is for educational purposes only.
Forum skin by poetic_folly