New OOP permissions system

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
phpBBInstaller
Registered User
Posts: 10
Joined: Sat Jan 15, 2005 2:33 pm
Location: Birmingham, AL
Contact:

Re: New OOP permissions system

Post by phpBBInstaller »

Luciano wrote: well i was told (it could be wrong though) that when programming with classes you use less of memory.. (I meen php memory :mrgreen: )

Luc
That's the type answer I had in mind. Can anyone confirm this?

User avatar
Ptirhiik_
Registered User
Posts: 526
Joined: Tue Nov 18, 2003 8:35 am

Re: New OOP permissions system

Post by Ptirhiik_ »

Actualy I don't think so, rather the contrary truly talking : as you handle structured data, they are commonly more heavy than flat data. With php5, some improvement has been made regarding the addressing of objects (absolute vs dynamic), but it is not yet a real OOP language as it can be undrstood for C++ ie.

phpBBInstaller
Registered User
Posts: 10
Joined: Sat Jan 15, 2005 2:33 pm
Location: Birmingham, AL
Contact:

Re: New OOP permissions system

Post by phpBBInstaller »

Ptirhiik_ wrote: Actualy I don't think so, rather the contrary truly talking : as you handle structured data, they are commonly more heavy than flat data. With php5, some improvement has been made regarding the addressing of objects (absolute vs dynamic), but it is not yet a real OOP language as it can be undrstood for C++ ie.
Thanks, that's actually what I thought. That's the reason that I was wondering. I also think that classes are more difficult for the average PHP programmer to understand so I was just wonder why the decision was made to do this.

Yoda_IRC
Registered User
Posts: 158
Joined: Tue Mar 01, 2005 10:19 pm

Re: New OOP permissions system

Post by Yoda_IRC »

you sure? don't function and method calls have overhead because php has to remember where they are called from to return control once it has finished executing the mthod/function?

PHP is not a pure OOP language, for instance it is perfeclty possible to write a prgram with no use of classes. However in languages like Java which is object orientated classes are essential, it libaries are accessed through objects, your program should be an object etc.

Classes are ment to make stuff easier however. Once you know how to use it that is. For instance when making a permission system, you can use an Object for users, but as Admin are a special kind of user you could inherit/extend/derive it from the user class. However the real phpBB system is proberly completely differant and alot more complex

kieroth_whiteleaf
Registered User
Posts: 72
Joined: Wed Apr 07, 2004 7:23 pm

Re: New OOP permissions system

Post by kieroth_whiteleaf »

In my experience programming with classes is more efficient on the programmer because it's easier (once you get the hang of it) and significantly more flexible. I don't know what the dev team's particular reasoning is, but the other thing I can say is that everyone is just a little different in how they code.

I've been told that my web code is "virtually incomprehensible" because of the way I do things, but that's a throwback to the way I learned it. Unlike a lot of the people I work with, I had early formal training in BASIC (as an elementary student, one of those freak gifted programs) adapted a lot of it to pascal (mostly trying to get the functions to match what I could do in basic, since that's where I was comfortable) while adding in some of the stuff pascal can do that basic couldn't. Then I moved into Visual Basic (self-taught) and had to adapt again. Then for some reason (okay, I was stupid) I migrated into ASP before landing into PHP - so when I can't solve a problem directly in PHP (because it's more of a C derivative and I never learned that one) I end up trying to solve it how I would've solved it back in BASIC. That leads to some strange code sometimes... so I've got a hybrid of code that looks like C (which is significantly more effective, uses things like classes, etc) and a lot of old throwback "patch" code where I use adapted basic to hold things together when I couldn't figure out the C methodology. And comments are for people who don't know how to code ;) (j/k - I really appreciate when people comment their code, I'm just generally too lazy to do it outside of notes for me, and I've been told that my shorthand is actually worse than no comments at all...)

One of my friends is a pretty good natural programmer, but he doesn't have experience in more than just a touch of C and some PHP, so his functions look very textbook but he's not particularly adaptable. His code is VERY easy to read but it's not as flexible.

But in the end our programs pretty much function the same - it's just how we got there that's a bit different.

If classes are being used rather than functions, there's a decent chance that it's simply that the devs feel more comfortable in classes than anything else so that's how they're working. Although knowing how they feel about performance/load times/etc I'd venture to guess that classes are more efficient for whatever they're doing on the processor side more than the programmer side.

SFG

friendly-art
Registered User
Posts: 40
Joined: Fri Jan 30, 2004 2:43 pm
Location: Kiev, Ukraine
Contact:

Re: New OOP permissions system

Post by friendly-art »

I think the main reason is minimizing use of global variables.

Ybarra
Registered User
Posts: 15
Joined: Mon Jun 09, 2003 3:12 am

Re: New OOP permissions system

Post by Ybarra »

The main reason, as stated in the past, is more consistency (2.0.x was a mishmash of OOP and procedural) and simplified mod writing and installation.

I haven't read much of the 2.1 (3.0) code yet, but one advantage of OOP is the ability to add or completely change functionality without having to alter existing code. Classes can be extended by new classes...replacing functions within those classes and adding new data and functions. This makes for less complicated MOD installation, for one thing. This is one of the most powerful concepts that objects/classes provide...

There is the disadvantage that most PHP coders are procedural coders, requiring them to learn a new way of thinking to be able to MOD 3.0 as well as they could 2.0.x. This disadvantage should be temporary as any self-respecting programmer should learn OOP fundamentals anyway.

There's also the performance to consider, as OOP programming is generally less efficient than procedural...it's an efficiency vs. organization trade-off.

friendly-art has a point, as well. Encapsulating everything within classes has some security benefits.

Amorya
Registered User
Posts: 56
Joined: Mon May 26, 2003 3:15 pm

Re: New OOP permissions system

Post by Amorya »

Ybarra wrote: There is the disadvantage that most PHP coders are procedural coders, requiring them to learn a new way of thinking to be able to MOD 3.0 as well as they could 2.0.x. This disadvantage should be temporary as any self-respecting programmer should learn OOP fundamentals anyway.
I'm a procedural coder. I'm planning a big project based on Olympus (like a CMS but with features geared towards university societies), so I may have to get better at OOP. I did some WebObjects development, which helped, but it was an exercise in frustration for me...

Just looked at some of the CMS code. As an example... one thing I'll want to do is modify the function format_date(). This is now part of the class user. Is there a way I can modify that class that's better than just going in and changing the code?

Amorya

User avatar
Ptirhiik_
Registered User
Posts: 526
Joined: Tue Nov 18, 2003 8:35 am

Re: New OOP permissions system

Post by Ptirhiik_ »

Inheritance sounds like being a convenient way, but halas it is not really the truth : first you have to modify all instanciating of the objects to use the new class, then you don't know if another modifications hasn't been already made with the same class, so having its own inherited definition : at this time, modifying the code into the original class def is probably the best solution to avoid this side effect. Perhaps when multi-class inheritance (basicely merge of many class into only one) will be introduce in php, you will got some solutions regarding this.

ab9db
Registered User
Posts: 5
Joined: Sat May 07, 2005 7:54 pm

Re: New OOP permissions system

Post by ab9db »

Quick question,

Will these permissions be set up by admins within the control panel?

So will admin be able to create a group and define it's control panel powers?

Post Reply