| 
	
 | 
 Posted by Thomas Mlynarczyk on 06/15/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
 
  
Navigation:
[Reply to this message] 
 |