Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
astions wrote:
You didn't qualify that statement. Are you saying I'm not experienced because I'm not passing objects to other objects? I've never had to do that and I've built some pretty complex systems. If I tell a class to do something I just want to know if it did it or not. I don't want to have to test to see if it returned an error object and then pass that error object to another class to figure out what the error is. If it returns false and I need to know I'll ask it, not something else.
I'm saying that your code tells me that you aren't an experienced OO programmer, I didn't say anything about overall programming experience. It lacks an overall OO design (using objects is just the beginning) and it is basically procedural code with some OO syntax mixed in. It is not something specific I can point out, basically it is something gained through experience - hence I assumed you lack it (in OOP).
Who's the say that the current wheel rolls the best if no one tries a different design?
I hear that a lot from programmers new to OO, and somehow they all come around at the end . The software development community is somewhat similar to the scientific community - there is a lot of sharing of ideas, methodologies and techniques. The concepts that stand the test of time and become universally accepted as good practices probably have some basis to them, wouldn't you say? Of course it's always good to challenge those conventions, but try learning it before you dismiss it. When you have enough experience in it to say you can do better, then you'll have good arguments to support you
php|architect's Guide to PHP Design Patterns by Jason Sweat
PHP 5 Objects, Patterns, and Practice by Matt Zandstra
Advanced PHP Programming by George Schlossnagle
MySQL Cookbook by Paul DuBois
Web Standards Solutions by Dan Cederholm
Bulletproof Web Design by Dan Cederholm
Web Systems Design and Online Consumer Behavior by Yaun Gao
among others. I learn and absorb what I am exposed to but I'm not going to jump on the bandwagon if I think I can do better, and so far the results have been acceptable to me, other than being looked down upon here on devnet because I'm different.
At my last programming position I was outperforming other programmers by a 3:1 margin.
For me the biggest jump in OO understanding came from using the Zend Framework and learning over time how it is built and modeled. I'm not saying they got everything right, but I learned a lot from looking at the code and how they implemented different patterns and methodologies.
pytrin wrote:It lacks an overall OO design (using objects is just the beginning) and it is basically procedural code with some OO syntax mixed in.
Ok, I'm from the show me state. Show me some good code and tell me why it's good. I'll either agree or tell you why I disagree.
I'm always a step behind you
Tell me what kind of code you would like to see - do you want me to give a go at remodeling your multi step form in OO design? If so, is that the entire code or is there more of it?
pytrin wrote:Tell me what kind of code you would like to see - do you want me to give a go at remodeling your multi step form in OO design? If so, is that the entire code or is there more of it?
Show me what you think I should see I guess. Whatever you want, if you want to remodel the register code I posted, or show me someones best work that is fine. Just point out the benefits so I see them.
And yes, that is the entire page. There isn't any other code except for the classes.
pytrin wrote:I will have a shot at it later today when I finish work (yes, I waste time at work writing in PHP forums...)
Ok cool. I was checking out the Zend framework and I see that mine is similar in many ways, with a few major exceptions. Mine doesn't pass objects to other objects and much less code is involved setting everything up. I haven't created the ACL, Memory and all the other off the beaten path classes for it.
@arborint: Your comments seemed pretty harsh. Why are you saying that all my classes are just namespaced procedural functions? They are reusable classes that can be used in a variety of ways in many combinations. This simplistic design is a lot more powerful than I think you're giving it credit for.
superdezign wrote:Who's the say that the current wheel rolls the best if no one tries a different design?
Do you honestly have something new to add in Mechanical Engineering or Chemical Engineering or Physics or Biology? Is Software Engineering somehow so different that it is immune to reality? You may think it sounds 'harsh' but do you really think that you or astions or I are going to come up with some new way to do things in Software Engineering that is brilliantly better? Are there equivalent young Mechanical Engineers or Chemical Engineers who are likewise trying something different with brilliant results? I honestly think your premise is absurd.
Sooo are you saying that google has the best search algorithm and that it's impossible to create anything better because a group of smart people already came up with something?
Your comment reminds me of the patent office guy who said, "Everything that can be invented has been invented".
astions wrote:@arborint: Your comments seemed pretty harsh. Why are you saying that all my classes are just namespaced procedural functions? They are reusable classes that can be used in a variety of ways in many combinations. This simplistic design is a lot more powerful than I think you're giving it credit for.
Yes, pretty harsh. But not half as harsh as I am about my own code -- which I don't think is very good. You can look at the publicly available code of the Skeleton framework, some of which is my work. I would never say it is "very robust, very efficient, easy to modify" because I honestly know how far my code needs to go to be compared to the best of our profession.
If you are interested in going through some of your code and refactoring it, I would be glad to be involved in the process. But I am not sure you are really that open to new ideas, given how you talk about your code. Ask pytrin about the brutal, rough-and-tumble of really design discussions about framework code. I learn something every day from smart guys like pytrin. And I will be honest that my code is still a "complicated design that is a lot less powerful than you would give it credit for" ...
astions wrote:Sooo are you saying that google has the best search algorithm and that it's impossible to create anything better because a group of smart people already came up with something?
Your comment reminds me of the patent office guy who said, "Everything that can be invented has been invented".
I think that is an excellent example. Those guys were maths and computer science PhDs from Stanford! So other very smart people may come up with a new brilliant idea -- but the chance that you, superdezign or I will is between slim and none. Honestly ... get real!
arborint wrote:So other very smart people may come up with a new brilliant idea -- but the chance that you, superdezign or I will is between slim and none. Honestly ... get real!
The education gave them the resources to put their idea into action. The idea was to rank pages based on inbound links. Anyone could have thought of that -- me, you, superdezign, pytrin. It's all about having a positive outlook. You put down your code and you think that you could never have a brilliant idea. That's not a good attitude for success. You may have great ideas all the time but you never do anything with them because of your logic. I'd think about that.
I'll tell you what. I'll strip the framework down to the parts that I am satisfied with and publish it. Give me a few days. I'm going to pull out classes that I'm not happy with because I don't want them interfering with the overall opinion of the framework as a whole.
This is what I was afraid of though. This code is so different that I think there is going to be a lot of negative kneejerk reactions. I ask you to keep an open mind and not write it off because it deviates from the norm. I will say that it's very versatile. If you want to do MVC with it you could, with very little or no modifications. Personally I don't like creating 2 or 3 files to create a single webpage, but that's just me.
astions wrote:The education gave them the resources to put their idea into action. The idea was to rank pages based on inbound links. Anyone could have thought of that -- me, you, superdezign, pytrin. It's all about having a positive outlook. You put down your code and you think that you could never have a brilliant idea. That's not a good attitude for success. You may have great ideas all the time but you never do anything with them because of your logic. I'd think about that.
Again quite honestly, it is not "all about having a positive outlook." I agree that having a positive outlook is a good quality, but it is not a replacement for years and years of education and hard work. It is not a replacement for innate mental abilities either. I am not being pessimistic in the least -- just realistic.
astions wrote:I'll tell you what. I'll strip the framework down to the parts that I am satisfied with and publish it. Give me a few days. I'm going to pull out classes that I'm not happy with because I don't want them interfering with the overall opinion of the framework as a whole.
This is what I was afraid of though. This code is so different that I think there is going to be a lot of negative kneejerk reactions. I ask you to keep an open mind and not write it off because it deviates from the norm. I will say that it's very versatile. If you want to do MVC with it you could, with very little or no modifications. Personally I don't like creating 2 or 3 files to create a single webpage, but that's just me.
Give me a few days.
Honestly, I think that is a waste of time. Almost everyone here had a code base that they thought was different and brilliant and misunderstood at one time. But the reality is that is was simply internally consistent to their current acceptable trade-offs, but really not that good. And trust me, the amount of time to really analyze your code base is too much to expect of others. If you really think you have misunderstood, brilliant ideas then start a new framework project or join an existing one (I know a framework team that needs both brilliant ideas and hard work ).
Ok astions, I tried to go over your script but I quickly realized there are things missing and other things that just aren't clear to me.
* Where are registration steps 2 and 3? what is the skip variable used for?
* What does the $KERNEL object encapsulate (and where does it come from? I don't see it being instanced. It is not a global by any chance?) - it seems to be a general use object that is simply a function storage, or am I wrong?
* Is the 'change_destination' method a hard redirect? if so, why are you using redirection in the same page?
I assume that many of the questions I have seem obvious to you since it's your design. This is where good OO modeling is usually evident - how obvious is the design to someone who isn't familiar with it?