|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#31
|
|||
|
|||
|
Re: Do I really need class?
Ohh, I don't agree, at the moment I work at a company that does build websites/applications with lots of code sharing.
We have a lot of systems that we can just take and add on to an existing project. Or that we can base new systems on (although a lot of it is still in ASP, not PHP, which I wanna kill my boss for, it's not so much a costumer demand, so it's my boss' fault ! ;). |
|
#32
|
|||
|
|||
|
Re: Do I really need class?
That's awesome... I didn't realize that PHP had hit mainstream corporate use yet.
I think what I meant to say in my post was that its difficult to appreciate the use of objects in any language when working on relatively small projects. The questions that these guys raised weren't on the practicality of objects in PHP so much as they were on the practicality of objects in general. When writing smaller programs, it can actually be more cumbersome to use objects, but theres definitely a point at which their implementation becomes a great time saver. |
|
#33
|
|||
|
|||
|
Re: Do I really need class?
I'm sorry I did probably make a wrong title to my posting "Do I really need classes?"
But what I meant is that the article we are discussing doesn't make it clear enough. I just wanted to comment the article, not the use of classes itself! And by small projects the use of classes is really not so obvious. |
|
#34
|
|||
|
|||
|
Re: Do I really need class?
If they are not obvious in a small project. A good thing would be to use atleast several function, maybe if you ever want to you can use atleast that again. Also it will help you keep structure in your work (trust me it's a good idea).
|
|
#35
|
|||
|
|||
|
problem w/classes??
Having some trouble with classes that I'm hoping someone will be able to help me with. I've pretty much solved the problem but am more interested in why the code executes differently on two different machines.
<br> <br> Here's the scenario: <br> <br> On win2k/IIS/PHP 4.0.3, I set up a class like this: <br> <br> class myClass { <br> <br> var $thisVariable = "test"; <br> <br> function getVariable(){ <br> $this->variable = $thisVariable; <br> echo $this->variable <br> } <br> <br> } <br> <br> When I instantiate it, it returns "test" but when I upload the file to my website server, which is Apache running PHP 4.0.2, it refuses to return anything.. but when I set it like this: <br> <br> class myClass { <br> <br> var $variable; <br> <br> function getVariable(){ <br> $this->variable = "test"; <br> echo $this->variable <br> } <br> <br> } <br> <br> It works just fine. Any idea why? <br> <br> |
|
#36
|
|||
|
|||
|
Re: Do I really need class?
So if I understand here... a class is sort of like a way to have a function, but to totally and completely separate it from the rest of the code-- that is, within a class, I can use any variables, any/many functions, etc. and they all are 100% transportable, where functions can still bump into other functions, etc. Is that right?
It also seems like classes are a formal way to group a bunch of functions together in one portable bundle... right? -E |
|
#37
|
|||
|
|||
|
constructors
Why did you choose to go with the
function Start() in the Automobile class? why not use a constructor. class Automobile { function Automobile() { // code goes here. } } $his = new Automobile; now you don't need to run nthe 'Start()' function, when a new variable is created of type Automobile, the Automobile function will be automatically executed. Chris Lee |
|
#38
|
|||
|
|||
|
constructors
Why did you choose to go with the
function Start() in the Automobile class? why not use a constructor. class Automobile { function Automobile() { // code goes here. } } $his = new Automobile; now you don't need to run nthe 'Start()' function, when a new variable is created of type Automobile, the Automobile function will be automatically executed. Chris Lee |
|
#39
|
|||
|
|||
|
Separating GUI and functionality
Hi<br>
<br> I think the article explains very well some of the basics of OO programming.<br> On the other hand the examples are show exactly what NOT to do when developing webapplications (and other GUI applications).<br> If you want to create an easily maintainable application you have to do an efford to separate the GUI from the program logic. Imagine a webdesigner wanting to change some attributes of a table: he/she would have to get a programmer to help and a simply one-person/two-minutes task suddenly involves two persons and takes n-minutes.<br> The solution for creating webapplications is to use some kind of template engine e.g FastTemplates at www.webmasters.net.<br> I'd love to see articles about other PHP template systems.<br> <br> Regards, Thomas |
|
#40
|
|||
|
|||
|
Yep
Yeah, I was scratching my head over this
<br> one too. I think the drawTable() method <br> from the earlier example should be put in <br> the body of the non-extended Table class <br> and the drawTable method should be <br> overridden by the extended class (I assume <br> this is possible although the tutorial <br> doesn't mention it). <br> <br> Chris <br> <br> P.S. Otherwise an excellent tutorial! |
|
#41
|
|||
|
|||
|
asdfjasld
kj;faslkdjf;aslkdjf;lkjaslkdf
|
|
#42
|
|||
|
|||
|
asdfjasld
kj;faslkdjf;aslkdjf;lkjaslkdf
|
|
#43
|
|||
|
|||
|
Re: U guys F***n' rock!!
sdfgsdfg
|
|
#44
|
|||
|
|||
|
Re: coment
asdfsadfsadf
|
|
#45
|
|||
|
|||
|
Re: coment
eryteryt
|
![]() |
| Viewing: Dev Shed Forums > Other > Development Articles > Back To Class |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|