Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-30-2008, 06:43 PM Modules
Registered User

Posts: 48
Trades: 0
I want to make a base script then i want to add the possibility of adding later features through modules without the needs to hack the existing base code.
Please tell me a good method to achieve it...

Thank you.
ClaFanN1 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-31-2008, 12:52 AM Re: Modules
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Probably you should use object programming, in particular each of your modules should be a class which implements some interface. In the very end you will come up with creating an object of some class and call $object->generate() method somewhere in your page template to get it's output into your page. Something like that.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 03-31-2008, 07:52 AM Re: Modules
Registered User

Posts: 48
Trades: 0
I do hate classes lol
I dont even know php very well and you start talking about classes

object programming is like alien language i just cant get it, too weird to me :\
Also it is very slow...no worth using.

Last edited by ClaFanN1; 03-31-2008 at 07:56 AM..
ClaFanN1 is offline
Reply With Quote
View Public Profile
 
Old 03-31-2008, 10:01 AM Re: Modules
mork29's Avatar
Extreme Talker

Posts: 242
Name: Keith Yelnick
Trades: 0
Quote:
Originally Posted by ClaFanN1 View Post
I do hate classes lol
I dont even know php very well and you start talking about classes

object programming is like alien language i just cant get it, too weird to me :\
Also it is very slow...no worth using.
You've obviously never used a "good" object oriented language like Objective-C. Learn objective-c and tell me that OOP is a waste of time and resources... Beautiful is the only way I can describe it...

PHP does have one of the WORST implementations of OO concepts. That being said, it is improving greatly, and would be the best way for the OP to implement his goal. However, the lack of good inheritance features make this much harder with PHP. Just ensure everything you write is very well documented, follow standard rules of good coding, utilize PHP's limited OO features, and your life will be much easier later on.
mork29 is offline
Reply With Quote
View Public Profile
 
Old 03-31-2008, 11:12 AM Re: Modules
Registered User

Posts: 48
Trades: 0
Documentation? I dont like to do that either...
My scripts have much documentation as desert has fish

Anyways...i do think i can write modules with normal programming cant i? Classes are nothing but a compiled function set box

I do prefer performance over (easy to write?!!) code <.< +.+ >.>

Last edited by ClaFanN1; 03-31-2008 at 11:24 AM..
ClaFanN1 is offline
Reply With Quote
View Public Profile
 
Old 03-31-2008, 11:34 AM Re: Modules
mork29's Avatar
Extreme Talker

Posts: 242
Name: Keith Yelnick
Trades: 0
So, you asked for advice, got good advice, and then said that you don't care about what the advice is, you're going to continue to do things how you've always done them? That doesn't make much sense.....

And what is a "Compiled Function Set Box". In all of my years of programming I've never heard of this....
mork29 is offline
Reply With Quote
View Public Profile
 
Old 04-01-2008, 01:37 AM Re: Modules
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
In php5 OOP is done pretty well. I never used OOP before because I really didn't need it, but my current project is written with classes and objects and I can say that it works really fine. I cannot definitely say about performance degradation, but the development speed-up is obvious.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 04-01-2008, 07:27 AM Re: Modules
mork29's Avatar
Extreme Talker

Posts: 242
Name: Keith Yelnick
Trades: 0
Quote:
Originally Posted by mtishetsky View Post
In php5 OOP is done pretty well.
Only if you're comparing it to PHP4. Compare features to a language like Objective-C and you will see just how crippled PHP's implementation is.

Quote:
Originally Posted by mtishetsky View Post
I cannot definitely say about performance degradation, but the development speed-up is obvious.
Writing in an object oriented fashion will generally harm performance, simply because of the focus of the coding. This only holds true if your comparing it to very well written and maintained procedural code. However, as procedural code grows with later additions, you'll likely find yourself using ugly hacks and workaround, and probably introducing whole new bugs and slowdowns. This is when OO methods begin to shine. You're also correct that the development speed-up is obvious, especially if you're not the only one working on the code.

All of that being said, I love object oriented code, and PHP is making good improvements in this area, but still has a LONG way to go.
mork29 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Modules
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.20675 seconds with 12 queries