Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #31  
Old November 5th, 2000, 06:22 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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 ! ;).

Reply With Quote
  #32  
Old November 5th, 2000, 06:52 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #33  
Old November 6th, 2000, 02:55 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #34  
Old November 6th, 2000, 03:07 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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).

Reply With Quote
  #35  
Old November 7th, 2000, 01:51 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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>

Reply With Quote
  #36  
Old November 14th, 2000, 12:43 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #37  
Old November 14th, 2000, 02:19 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #38  
Old November 14th, 2000, 02:19 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #39  
Old November 21st, 2000, 09:45 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #40  
Old November 23rd, 2000, 02:13 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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!

Reply With Quote
  #41  
Old November 29th, 2000, 08:47 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
asdfjasld

kj;faslkdjf;aslkdjf;lkjaslkdf

Reply With Quote
  #42  
Old November 29th, 2000, 08:50 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
asdfjasld

kj;faslkdjf;aslkdjf;lkjaslkdf

Reply With Quote
  #43  
Old November 29th, 2000, 08:59 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: U guys F***n' rock!!

sdfgsdfg

Reply With Quote
  #44  
Old November 29th, 2000, 09:01 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: coment

asdfsadfsadf

Reply With Quote
  #45  
Old November 29th, 2000, 09:03 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: coment

eryteryt

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Back To Class


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |