Jump to content

OOP concepts

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
HayDee

HayDee

    Newbie

  • Members
  • Pip
  • 1 posts
Hello!

I've never used OOP beforse, so I can't understad how to design an object's class. Most tutorials are only explaining OOP syntax, but they don't explain deeper principles how to use OOP.

For example, if I want to make a class which would list all files in some directory, should I make that class so that EVERY listed file is an instance of that class with it's own properties and methods, or should I make only one instance of that class with a constructor method, that calls listFiles method, sets curret directory propertie, etc... ?

Hope you can share some links or book names where OOP would be explained deeper. :)
Thanks.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Unfortunately, explaining OOP is a little like explaining how to use an if statement correctly. You kind of play with examples of OOP programs for a while, and you look at other designs, or you might pick up a book of about 250 pages that will go way in depth, and one day you start getting those AHA moments.

Looking at your example, for instance, it depends ENTIRELY on what you want done. You may have several objects, or just one that contains a list of strings, or...
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog