Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 769 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

OOP for a PHP Newbie

Thread title: OOP for a PHP Newbie
Closed Thread  
Page 1 of 2 1 2 >
    Thread tools Search this thread Display Modes  
08-21-2007, 04:27 PM
#1
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old  OOP for a PHP Newbie

Hello,

I'm still a PHP newbie but I'm looking forward to learn OOP concepts(according to PHP) first. The PHP manual is not detailed and very hard to grab the concepts.

Please find me a good resource for a programming beginner to learn OOP.

Salathe? WildHoney? Village Idiot?

Thanks,
Haris

08-21-2007, 04:48 PM
#2
Wildhoney is offline Wildhoney
Wildhoney's Avatar
Status: Request a custom title
Join date: Feb 2006
Location: Nottingham
Expertise:
Software:
 
Posts: 1,648
iTrader: 18 / 95%
 

Wildhoney is on a distinguished road

Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney

  Old

Sorry, I've never been one for reading tutorials of any kind. I read sites that spew information, such as what to use MySQL for and what not to use MySQL for, but other than that, I dive straight in and get my paws dirty.

08-21-2007, 05:22 PM
#3
Bennett is offline Bennett
Status: Narassist
Join date: May 2005
Location: USA
Expertise:
Software:
 
Posts: 4,469
iTrader: 32 / 100%
 

Bennett is on a distinguished road

Send a message via MSN to Bennett

  Old

In my opinion; I've yet to find a coding website that provides a straight forth answer to most coding questions without lengthy overdetailed long writings to go through. You're best bet is deconstruct a larger script and find someone you can bounce a couple of questions off of.(That someone can be google =p)

08-21-2007, 05:48 PM
#4
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

My suggestion would be to initially broaden your horizons when attempting to understand OOP and what it is all about. Look back into more developed arenas such as Java. Or (and), go more theory based by looking at Object Orientation in a broader sense -- it's relation to other programming paradigms (there are lots). There is no shortage of valuable information available either digitally or in (often huge tomes) books.

If you restricted your learning specifically to PHP's OOP implementation then, in my own point of view, you wouldn't be getting the best out of your time. Nor would you get the whole picture, or anything close.

Are there any areas that you've looked into so far and had trouble understanding (please don't say, "the whole concept" )?

08-21-2007, 05:53 PM
#5
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Originally Posted by Salathe View Post
My suggestion would be to initially broaden your horizons when attempting to understand OOP and what it is all about. Look back into more developed arenas such as Java. Or (and), go more theory based by looking at Object Orientation in a broader sense -- it's relation to other programming paradigms (there are lots). There is no shortage of valuable information available either digitally or in (often huge tomes) books.

If you restricted your learning specifically to PHP's OOP implementation then, in my own point of view, you wouldn't be getting the best out of your time. Nor would you get the whole picture, or anything close.

Are there any areas that you've looked into so far and had trouble understanding (please don't say, "the whole concept" )?
Ruby on Rails. I'm jumping into PHP OOP's and will try to make my first ever OOP application. I've created one application in Ruby (Only ruby) but still didn't grabbed the WHOLE correct concept. I haven't used neither Ruby or Ruby on Rails much.

I'll try to re-create what I've created in Ruby.


Make an OrangeTree class. It should have a height method which returns its height, and a oneYearPasses method, which, when called, ages the tree one year. Each year the tree grows taller (however much you think an orange tree should grow in a year), and after some number of years (again, your call) the tree should die. For the first few years, it should not produce fruit, but after a while it should, and I guess that older trees produce more each year than younger trees... whatever you think makes most sense. And, of course, you should be able to countTheOranges (which returns the number of oranges on the tree), and pickAnOrange (which reduces the @orangeCount by one and returns a string telling you how delicious the orange was, or else it just tells you that there are no more oranges to pick this year). Make sure that any oranges you don't pick one year fall off before the next year.

08-22-2007, 06:35 PM
#6
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Tutorial is now here to keep it easy to maintain and give to other people.
http://www.talkfreelance.com/showthr...536#post381536

08-22-2007, 08:24 PM
#7
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

Thanks a lot Village. This would really help me in creating my first OOP script.

Thanks again.

08-23-2007, 07:48 PM
#8
hunter is offline hunter
Status: I'm new around here
Join date: Aug 2007
Location:
Expertise:
Software:
 
Posts: 4
iTrader: 0 / 0%
 

hunter is on a distinguished road

  Old

*Bookmarked, saved, etc*

This was really, really helpful. I've been looking for an explanation like this for quite a while now. Thanks dude.

08-24-2007, 09:20 PM
#9
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

How do you get conditional statements between classes(functions)?

Example:

PHP Code:
    public function oneYearPasses(){
        
$TheHeight $this->_Height++;
        
$return_val 'The '.$this->_Type.' Tree grows to '.$TheHeight.' meter <br/>';
        return 
$return_val;
        
        if(
$TheHeight == 10){
            
$return_val '<b>Your Tree is now mature and grows 10 fruits</b>';
            return 
$return_val;
            
$this->_Fruit 10;
        }
    } 
The if statement doesn't return the value when reaches to 10 meters.

08-24-2007, 09:35 PM
#10
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

-deleted response to deleted post-

Closed Thread  
Page 1 of 2 1 2 >


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed