Reply to Re: Classes without instances

Your name:

Reply:


Posted by Thomas Mlynarczyk on 11/02/40 11:32

Also sprach Weird-beard:

> In object oriented programming, everything should be an object.

So the "perfect" OO-Script would consist on the global level of only class
definitions, maybe some constant definitions or global configuration
variables and one simple instantiation statement at the end which would (via
the constructor function) start the actual processing?

Might I not encounter a situation where a function is of a "global" nature,
meaning that it is needed by several objects and cannot really be associated
with any existing class? Should I create a new class with a single element -
that function - then?

> Such discussions are into oop and once you begin to go completely OOP,
> you will see the advantages, though it may be seeming ridiculous now.

I'm all in favor of OOP, but IMHO there *are* situations where a non-OOP
approach is more appropriate.

> Php4 was not OO, and being able to use a function as you mentioned may
> not seem like a problem in the beginning, but once you begin using
> other people's classes or using your classes a while later, you may
> not be able to determine if a function was designed to run without
> instantiation or not.

As there would/should have to be some documentation about the code, this
detail ought to be mentioned there or could be communicated by typographical
conventions like

Class to be instantiated: name starts with a capital letter
Class not to be instantiated: name starts with a lowercase letter

By the way: are there some good articles on the net which discuss such
issues in more detail? Detailed advice on good coding practise is not
available in the manual.

Greetings,
Thomas

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация