Part of the EllisLab Network
   
3 of 4
3
10 abnormalities in CodeIgniter that everyone should know
Posted: 17 March 2008 08:36 AM   [ Ignore ]   [ # 31 ]  
Lab Assistant
RankRank
Total Posts:  165
Joined  09-13-2007

Trust me I migrated to CI just because it supported PHP 4. There are so many frameworks which have been existing much before CI was even thought about. They all support PHP5 only from their roots. This makes the life of developers who cannot migrate to PHP4 a little difficult. My clients were not in any sort of mood of migrating to PHP5 any sooner. They wanted me to write the most optimized code with better managebility but it had to be with whatever is available. PHP4 was in picture and I have lack of options. Luckily I found CI and today even if I get to work with the most recent version of PHP and Mysql I would go with CI as the first option until the client thinks otherwise. I do not understand people thinking what they want for themselves when they should think what the community wants since the framework is for the entire community.

Please contribute to make this better instead of just asking for things which would force many developers to think differently.

I am sure with CI 2.0 the coolest guys at Ellislab would come up with something which would make CI another language to select rather than just a framework.

I just cannot think writing PHP code with CI in picture (ofcourse until situation demands one).

Good Day !!!

 Signature 
Profile
 
 
Posted: 17 March 2008 01:33 PM   [ Ignore ]   [ # 32 ]  
Lab Assistant
RankRank
Total Posts:  218
Joined  10-25-2007

son of a .... I had quite the reply written out here, and apparently the forum decided it didn’t want it (or it was too long?)

So I’m going to start of with just my answers for your list:

Profile
 
 
Posted: 17 March 2008 02:19 PM   [ Ignore ]   [ # 33 ]  
Lab Assistant
RankRank
Total Posts:  218
Joined  10-25-2007

Just a note Buda—I hope you’re aware that these are your opinions of shortfalls in the framework. I have opinions too.

1. 90% of the system is written in PHP 4, a deprecated version of the language.

As discussed, PHP5 is not the only version of PHP in use by companies. Claims that anyone developing in PHP4 are irresponsible is a complete falacy. I guess you just turn away any clients that come your way REQUESTING something written in PHP4 because they aren’t in a place to update their systems to make *you* happy (though TBH I wouldn’t be suprised if you said you did).

2. The framework doesn’t have a Front Controller. Strangely, the application controller becomes the Front Controller, this means that the framework can only load one controller at a time (per request).

I think this is what it should be. A user takes ONE action, which is mapped to ONE controller, which is provided by ONE request. The perception of multiple actions doesn’t translate to HTTP.

3. The CodeIgniter/CodeIgniter.php file is not a class, it should be part of the bootstrapper file, index.php.

I’m not really sure how you want to weigh heavily upon code maintenance and re-usability, yet are just fine with having multiple copies of the same code thrown into seperate bootstrap files. You do realize that you can use multiple applications on the same CI codebase and only need to lightly modify the bootstrap which will in turn re-use this code, right?

4. MyController > Controller > CI_Base. There’s no point of having 3 levels of inheritance. The only purpose of CI_Base is to return a single instance of the Controller, so it should be part of the Controller.

This falls back to your issues with people using PHP4; multiple CI_Base objects are required because multiple versions of PHP are supported. This is necessary, unless you want more wasteful code like you do in #3.

5. Namespaces: The Controller class doesn’t follow the naming convention, it’s not prefixed with CI_ like the rest of the core classes. This makes CI’s namespace support very unreliable.

This is debateable. I understand your opinion on this, but I also realize that models and controllers are *products* of the framework, not part of the framework.

6. The application controller acts as a Front Controller and Registry, it’s used to stores all the objects the framework needs.

This is just utterly wrong. The CI global object does this.

7. Circular reference: When the Front Controller (App. Controller) loads a model, the framework assigns to the model all the object properties of the Front Controller. This is the most obscure behaviour I found in CI.

Wrong again. Seriously? When a model is loaded, it inherits a reference to each of the CI global objects loaded libraries, allowing the framework objects and methods to appear locally in both models and controllers and allowing us to use $this->object->method rather than declaring “global $CI” everywhere and calling $CI->object->method.

8. The router.php file contains an array that uses the keys to store data and define regular expressions. If you define 100 elements, the Router class will loop through the entire array, extract the keys and execute 100 regular expressions.

I can’t really argue with this one, and most of us are probably in agreement that there should be a better way.

9. Common.php is not a class, it should be moved to the helpers/ directory and renamed to something more appropriate, like mvc_helper.php for example.

Common functions are required for the framework to operate, “helpers” are not.

10. Very poor OOP and almost no design patterns makes this framework very difficult to extend and maintain.

I’ve seen some bastardized implementations of Zend and other frameworks too—it doesn’t mean that they were any more or less “MVC” or pattern-friendly.

Honestly, it really doesn’t sound like you took an *objective* approach to this framework. Your pre-conceived notions as to how things should work and some of the response have the air of the elitest programmer mentality ("What I think is right, period” type of view). Statements like “but if you are still developing using version 4, that’s very irresponsible and unprofessional” are themselves irresponsible and unprofessional. I might *suggest* that a business owner consider an upgrade to PHP5, but that’s the end of it. If they aren’t in a position, far be it from me to be an elitest prick of a programmer and tell them, “then you’re shit out of luck and need to find someone else”. Is this what you do, or are you “irresponsible and unprofessional” when the job calls for it?

Seriously and not to be an ass in any way, it sounds to me like you’re the type of person who only thinks *your* opinion is the right way to do something. I’m also going to go out on a limb and say that you’re probably of the opinion that PHP wasn’t a “real” language until it got the object polishing of version 5..

I hope you’re not like that, but just so you know, that’s how you sound (in my opinion).

Profile
 
 
Posted: 17 March 2008 03:31 PM   [ Ignore ]   [ # 34 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5828
Joined  11-23-2003

Pygon, I am glad you figured out the forum.

I agree there are things that can be done better.

But many of those things really don’t fit a statement such as “abnormalities which we must all know about.” I think others were just piling on before they had their morning coffee.

#1 is beating a dead horse.  We have had this discussion countless times in this forum and it is a non point.  The PHP developers can deprecate PHP4 but that means jack in the real world.  Thank you for pointing out that CI uses PHP4 by the way, I’m sure most people here have not figured it out already.

#3 is nitpicking.  Did you throw this one in just to make a round number?

#9 See #3 (or maybe you are misunderstanding what helpers are meant for in CI)

#10 PHP4 itself is poor for OOP.  And some of your other points are related to the problems in PHP4 forcing design decisions which are probably not ideal.  Oh well, it is not my job to maintain the framework.  wink

Again, I think we can all agree there are things which are not ideal and I’m sure there are plenty of bugs which have not been fixed (in every piece of software on this solar system.*) Show me a framework which has 100% agreement on all decisions for the user base.  This is what makes the Zend Framework a great option.  You take what you want and leave the rest.

*Leaves open the possibility of an alien race on another galaxy which has figured out how to write bug free code.  This would be great because I would hate for a bug to botch up a good anal probing.  That’s something you hope just goes smooth the first time.  You don’t want for them to have to call in the engineering team right in the middle of the process.

 Signature 

EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 17 March 2008 04:52 PM   [ Ignore ]   [ # 35 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1711
Joined  06-10-2007

This discussion is getting rather absurd and far too emotional.

Any decent developer who has studied the CI core will realise it’s shortcomings, but the fact remains that CI works, it is fast, easy to learn, and easy to use.

I wonder why the OP felt the need to start this thread, it serves no real purpose for this community. (regardless of wether he/she thinks so)

I would rather see him/her post some positive contribution for CI instead.

 Signature 

URI Language Identifier | Modular Extensions - HMVC | Validation Callbacks into Models | View Object PHP5 | Read the User Guide

Profile
 
 
Posted: 17 March 2008 04:58 PM   [ Ignore ]   [ # 36 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  2858
Joined  07-14-2006

To make the best of this thread. What would be a better way to have custom routes?

edit : Wiredesignz did you read my answer before i send it wink

Profile
 
 
Posted: 17 March 2008 05:06 PM   [ Ignore ]   [ # 37 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1711
Joined  06-10-2007

Great minds think alike xwero LOL

 Signature 

URI Language Identifier | Modular Extensions - HMVC | Validation Callbacks into Models | View Object PHP5 | Read the User Guide

Profile
 
 
Posted: 17 March 2008 05:23 PM   [ Ignore ]   [ # 38 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5828
Joined  11-23-2003
wiredesignz - 17 March 2008 04:52 PM

This discussion is getting rather absurd and far too emotional.

Any decent developer who has studied the CI core will realise it’s shorcomings, but the fact remains that CI works, it is fast, easy to learn, and easy to use.

I wonder why the OP felt the need to start this thread, it serves no real purpose for this community. (regardless of wether he/she thinks so)

I would rather see him/her post some positive contribution for CI instead.

Wha?  What would a thread be without emotion!  You are talking about developers, a very opinionated bunch of people.  And anyways, it gives me a chance to pull out my adolescent jokes.

Pointing out bugs is… if you can share them.  To start a thread saying you found a long list of bugs but you can’t say what they are because the bug fixes belong to your employer is a bit ridiculous.  Why bring them up in the first place?  The bugs are important, everything else is just commentary.

 Signature 

EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 17 March 2008 05:42 PM   [ Ignore ]   [ # 39 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1711
Joined  06-10-2007

The bugs are important, everything else is just commentary.

Absolutely agree, I could not have said it better wink

 Signature 

URI Language Identifier | Modular Extensions - HMVC | Validation Callbacks into Models | View Object PHP5 | Read the User Guide

Profile
 
 
Posted: 17 March 2008 08:57 PM   [ Ignore ]   [ # 40 ]  
Grad Student
Rank
Total Posts:  94
Joined  10-24-2006

CI doesn’t fit the exact bill of being an object oriented mvc framework. It’s true. In fact, I figured this out a while ago and decided to go try Zend, Cake, Symfony, and looked at some non PHP frameworks like Django and Grails…

I’m back to using CI and mixing in some of the Zend Framework modules. Why? Because in the end I can get the job done quicker using CI, and it’s structured enough that with some basic discipline I can maintain the code very well. The rest were too complicated for their own good, or required learning languages like java and python which I’m just not familiar enough with. CI has it’s flaws. It probably is too loose. But, for a lot of us, it really has turned out to be the most productive way. In the end, productivity is the reason you choose a framework.

Profile
 
 
Posted: 23 March 2008 04:38 AM   [ Ignore ]   [ # 41 ]  
Grad Student
Avatar
Rank
Total Posts:  37
Joined  06-28-2007

I came across this thread while looking for something else, but it sparked my interest…

Buda - 14 March 2008 07:58 PM

I spent 3 months fixing CI bugs and re-designing the entire architecture of the framework. I was quite shocked to find out so many abnormalities and design errors.

CI Bugs?  Which bugs?

Buda - 14 March 2008 07:58 PM

1. 90% of the system is written in PHP 4, a deprecated version of the language.

This was initially one of the reasons I was skeptical about going forward with CI, but I understand and respect the decision to stay with PHP4.  I’ll be happy when we can all move on.

Buda - 14 March 2008 07:58 PM

2. The framework doesn’t have a Front Controller. Strangely, the application controller becomes the Front Controller, this means that the framework can only load one controller at a time (per request).

I’m actually really curious to hear a real-world scenario in which you would have a front controller load multiple other controllers.  I haven’t come across a situation where that’s been necessary.

Buda - 14 March 2008 07:58 PM

7. Circular reference: When the Front Controller (App. Controller) loads a model, the framework assigns to the model all the object properties of the Front Controller. This is the most obscure behaviour I found in CI.

This makes coding for the framework a lot more consistent. *shrugs*

Buda - 14 March 2008 07:58 PM

8. The router.php file contains an array that uses the keys to store data and define regular expressions. If you define 100 elements, the Router class will loop through the entire array, extract the keys and execute 100 regular expressions.

If there’s a literal match, it’s done instantly. Otherwise, yeah, it goes through all of them, just as you would expect it to.  Is there a better method?  Most frameworks use regular expressions for URI mapping, including Django.

When it comes down to it, I’ve found CI to be the best framework for down & dirty coding and for small to medium projects.  Anything massive usually entails using symfony or django, but I prefer CI any time it makes sense.  Coding for CI is easy and very clear, from my perspective, and it has an excellent user guide that’s broken up into logical chunks.  It doesn’t do everything, nor does it do everything perfectly, but I have enjoyed using it much more than any other framework.

Profile
 
 
Posted: 24 March 2008 11:09 AM   [ Ignore ]   [ # 42 ]  
Summer Student
Total Posts:  6
Joined  03-24-2008

this post is for buda,
I actually just registered for this forum because of this post. If it wasn’t for CI you wouldn’t even have a basis for your post and your boss wouldn’t have a basis for the code that he “owns”. It kills me that people like you take someone else’s code, modifies it, will not release your modifications and now claims that someone owns the code. Your boss owns the code? How can someone own something that is open source? Who’s your boss bill gates? are you trying to make up for something that happened in your childhood and how does posting that you found 10 things you don’t like make you feel? You my friend are a vulture, flying high looking for free things. If this code was licensed differently you would then be in a legal problem. If you use open source code then you are lacking the ethics of the open-source community. I found 20 things wrong with your code and I am looking for your forum to post what I found but I cannot tell how to fix them because my boss owns my code. I am sure you would feel different in that situation. Plus the even thought that you do not release your modifications gives me hope that someone will crack your bosses “own special framework”, because maybe, if you can wrap your narcissistic mind around this, the more people who look at your work the more secure it would be. You’re only human and you shouldn’t think otherwise.

Profile
 
 
Posted: 24 March 2008 11:41 AM   [ Ignore ]   [ # 43 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  03-21-2008

Hmm… In my opinion, if you don’t like it don’t use it.  There’s really no One framework that will work for everybody.  Some people like Cake, some people like CI and other like Kohana.  I guess it’s really just up to what we need and like.

Profile
 
 
Posted: 24 March 2008 11:47 AM   [ Ignore ]   [ # 44 ]  
Grad Student
Avatar
Rank
Total Posts:  55
Joined  02-05-2008

I’m actually just trying to clarify something. John Fuller wrote a post snarking on pygon ("Pygon, I am glad you figured out the forum.")

But I think buda is actually the one with all the complaints about CI.  o_O

As for me, I believe that there comes a time in every programmer’s life when they learn to rise above flame wars and pointless carping and realize that everything is just a tool, and that most of those tools work fantastically *in thier niche*.

Profile
 
 
Posted: 24 March 2008 02:35 PM   [ Ignore ]   [ # 45 ]  
Lab Assistant
RankRank
Total Posts:  176
Joined  02-25-2008

It’s a shame the thread has degenerated into this. Unfortunately it’s mostly the supporters of CI that have become offended and lashed out. I was hoping it was going to be a real discussion concerning some of CI’s shortcomings and how future versions of CI might compensate. I love codeIgniter but I’d love it even more if it addressed some of the points contained in the original message.

 Signature 

Webthink.ca - a CodeIgniter/Kohana Shop

Profile
 
 
   
3 of 4
3
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 61075 Total Logged-in Users: 20
Total Topics: 73897 Total Anonymous Users: 0
Total Replies: 398572 Total Guests: 327
Total Posts: 472469    
Members ( View Memberlist )