Compared to Kohana 3.1

“Nicely” is not an objective opinion. However, I don’t use every Yii source convention for my webapps. It’s a framework, I use features exposed by the framework, I don’t care about its coding style. If you code C# applications, do you care about the .NET Framework coding style? Not really. Methods/functions/etc. naming is the only convention you can see.

I don’t see unreadable code.

Probably it’s how PHP should have been written. Modern languages like Java, C# etc. use camel casing and it improves readability. This is one of the reasons why I chose Yii (and PRADO before): it’s fresh air for an old-conception language like PHP.

About guides… Kohana documentation is plain ridiculous compared to the Yii guide http://www.yiiframework.com/doc/guide/

Also, Yii class reference is better organized http://www.yiiframework.com/doc/api/

That __call() magic is very nice but it’s not less hacky than what you called hacky.

http://en.wiktionary.org/wiki/convention

Scaffolding is for developers who spend time doing something useful, manual CRUD is for monkeys. Also, I think you didn’t understand what Yii widgets are.

And what about permissions management? RBAC? Active Record? Caching (page caching, segment caching etc.)? Web service features (SOAP etc.)? Performance? I think that Kohana is nice… but it’s a toy.

If you add code, you also add brackets ;)

Alright - I was about to post a comment that one reason I like the Yii community is that it’s wonderfully free from evangelists and bashers, but Ekerazha proved me wrong.

;)

Like I said: I tend to follow the Zend coding conventions wherever I can.

They probably have good reasons for having it.

@Kemal

I understand your points, but still not changed my opinion regaring all initial questions, so do not see a sense to comment your answers, because it would be repeating the same using other words.

The only thing I’d like to discuss is HMVC request - Yii’s forward() also does not make any HTTP request and just runs another controller/action based on given route, so the idea is the same. It maybe not so convenient as in Kohana, because forward() will not return rendered content, but you can easily get it using php ob_xxx functions and also may need to manipulate with superglobals to pass parameters to the invoked controller. But both getting rendered content and passing parameters can be easily wrapped to something more OOP-like.

Am I missing something else regarding the HMVC?

Also it is interesting whether this concept is something widely used in Kohana projects or just an option for some complex cases?

@ekerazha

As I written above, the reason why I use brackets for single line statements is for more convenient debugging - otherwise I should step into methods invoked inside condition to be able step into the doSomething() method. When there is no brackets then whole statment executed in one step (I use Netbeans + xdebug, maybe there are some other options).

I thought i just drop my two cents here having experience with KO3 and CI, so here it goes:

It is pretty hard to put Yii and Kohana in the same “basket” because the only thing being the same between them is the fact they are frameworks, but that’s all, everything else is treated in other way for each of them.

People who blame Yii(or everything pointing directly to yii) are just frustrated people not understanding what Yii means. It is also true that Yii requires more experience from a developer than other frameworks, but it also offers some amazing features and a high development speed(this is by far the best advantage YII offers).

I don’t know about you, but in the company where i work, we always have some strict deadlines and we cannot afford to go over them. Time is money, really.

I have nothing against Kohana, au contraire, i use it pretty often and i like it a lot because it is very lightweight. I also use Codeigniter for same reason, being lightweight(though is true, Kohana is taking CI place in my projects because, well… unfortunately CI is behind the times, but i am forced to stay with it because i have more than 30 active projects built in CI which needs upgrading and maintenance and further development) .

Yii makes the developer job easy enough, easier than Kohana can do it, or CI matter a fact, but this comes with a price, a higher memory usage and CPU usage for each request, therefore the environment where the app will be deployed needs to be more "special". But when APC/XCACHE comes in place, this is not a problem anymore, at least not so big.

I really think the learning curve is the decisive factor when choosing a framework. Lots of people say Yii is easy to learn, which is false, i had a very hard time understanding it and also took some time to realize what goes where and why (I am coming here having 2+ years of CI background, not counting the procedural programming years and still was pretty hard for me to get started with yii), but now i am getting the point and it makes sense to me(though i know, i have a long road before me till i will really understand this framework).

In my case, i don’t stick to ONE framework because for some projects makes more sense to use one than another, so before i start building the website i look at the requirements and at the time given till completition and make my choice between the three of them (Yii/CI/KO3)

Just as a side note, i have started a modular CMS several months ago (based on CI) which is very mature right now, but as much as i would like to rebuilt it under YII, i am still not decided if i want to do so because of the memory usage. I have in mind the issue of shared web hosting, where the servers are not very powerful(or if they are, they are very loaded anyway) and the memory/cpu limit will be always a problem. So in this case, i would rather continue with CI or rewrite it in KO3.

(P.S: i may be going too far with this memory/cpu usage thing, but i had the bad luck to face very ugly situations because of the after mentioned issues, so that’s the reason i am being this way.)

As you see, beside the learning curve, the deploying environment is another important factor to take into consideration.

In the end, it is important to choose the right tool for the right job.

Keep in mind, there’s no universal tool that will match every job you need to do (that’s why we have 50+ php frameworks and 100+ Open Source CMS systems)

Well said, Twisted. :)

Yii is difficult?

It really depends on where you’re coming from…

I started out using CakePHP, and it was relatively easy for me because I already knew object-oriented programming in C++ and a tiny bit of MVC (Qt Framework) - still I spent some time getting over that convention thing. :)

Yii is a lot easier to get into - comparatively.

It’s also a lot more lightweight than CakePHP and Symphony.

Quite a lot, actually.

I bet you can almost get the same speed as Kohana and Code Igniter if you are clever, and rewrite expensive AR operations into regular sql queries.

Closer to the metal usually requires a bit more work, but it’s also (usually) easier to understand because it’s not abstracted as much.

Still, Kemal has a problem:

His boss wants him to use Yii, and he wants to use Kohana.

I won’t discuss framework vs framework anymore, as everyone here noticed (and in my own opinion, to be honest), no arguments can “proove” to developers on both sides that the other one is better. Reasons of my initiative are ‘explained’ below (not saying that I’m explaining myself!);

The company is growing really fast and all kinds of PHP developers are coming into the team; even those without any framework experience. Now, the learning curve for Yii is extremely slow, even for someone who has a lot of experience with many PHP frameworks, causing missed deadlines, costing the company a lot of development time / money. The only developers that get to actually use Yii and deliver “in time” would be those who’ve been late with it during the last year of using it. Not to mention how hard it is for new developers (especially those new to framework) to get on a project which’s been worked on for past 9 months.

So, I don’t really have a problem. My company has a problem, and I’m personally here to find a development side of solution.

Not to advertise Kohana, but it does have more than 5 ACL / RBAC modules, prepacked Cache module (besides the fragment / page / request caching which is developers job to introduce into the application). Let’s say that implementing REST with Kohana is practically a joke, thanks to HMVC and Request / Response rewrite (RFC 2616).

Concerning ActiveRecord, Kohana has more than 4 modules for that purpose only, it’s up to you to choose (prepacked ORM, Sprig, Jelly, AutoModeler). I won’t suggest you try ORM, you’re obviously guessing and being far more subjective than “I am”.

Again, I’m not here to flame, I’m here to get your subjective and objective opinions (tnx @twisted1919).

@jacmoe

well, for me it was pretty hard, i don’t know if you ever took a look into CI, but it is just something else than YII.

Kohana, being a fork of CI (well, it has it’s own road now) was easier for me to understand (example, i never posted a single thread on kohana forums because i never was in need for answers, i found the way by myself.

(i don’t know if it is just me, but kohana forum is very strange, pretty hard to follow for me)

But, the truth is, i am really happy that i choose to learn YII, i need to know as much as possible about as many things as possible.

Regarding the optimizations tips you were talking about, i agree with you 100%, those can be done, just that, right now i don’t feel i am an advanced YII user. Everything on it’s time :)


@Kemal Delalić

As i said, the learning curve is not the fastest one, but have you ever thought that as a personal goal, learning Yii would get you professional advantages ?

I am not sure how your company decides what to be used for what project, but i assume this is the role of the developers assigned for the project.

So leave aside the YII developers from your team(you know, they invested a lot of time in learning YII, would’t be nice to throw all that away, would it be ?) and maybe tell your project manager that you want to use your framework of choice in the project assigned to you, i am sure they can’t refuse this, makes no sense to do so.

When they accept, do an awesome job with your framework in a short time and impress them, then you’ll see what comes. There is now way for them to trust what you say about a framework unless they can see it in action.

Sadly, i have no other advices for you, but from my point of view, a company with people knowing to work with more than one framework(freedom of choice, right?), is a great company.

Btw, you are a lucky developer having to work only with frameworks :) (most of us, working on a daily basis with joomla/drupal/wordpress/OSC/Open Cart are not so lucky :) )

Blah blah blah talk about the subject and avoid personal attacks ;)

The mere purpose of a framework is to not reinvent the wheel, the fragment / page / request caching shouldn’t be “developers job”. Kohana is seriously lacking here. Also, you have to rely on third parties, amateur modules because it also lacks decent permissions and database management (not some minor feature). These are facts. And what about SOAP? And what about performances? Is there something like yiilite.php for Kohana?

As I said, there’s no point in discussing both frameworks with someone who hasn’t even tried both of them. Again, I’m not here to flame or h8, I’m here to get all kinds of opinions and you already gave yours’. Enjoy using Yii, I know I will :) (but not as much as using … whatever, you see? no point.)

Thank you for your opinion!

I agree. Unfortunately, this would exclude you from the discussion :)

Would it?

He is using Yii at his work - that’s the motivation behind this topic: convincing his company to move to Kohana.

His arguments prove that he has a shallow knowledge of Yii.

Meh… this seems pointless. You may:

  1. Learn to work with Yii.

  2. Tell your superior that you are not comfortable working with for Yii. Try to convince him/her to allow you to switch to kohana. If that does not work, then return to 1 or move on to 3.

  3. Leave your current job and find another where they will allow you to use whichever tools you like the most.

I believe your goal here is to get yii developers to agree with you that kohana is superior. I could be wrong though… I’ve tested literally over a hundred frameworks, and so far yii is the one I’m most comfortable using. Albeit, I have not used kohana 3.x yet (I have never had a reason to switch from Yii yet).

I suggest you have a read of my blog at Www.sheldmandu.com as I cover exactly this topic. Yii uses true OO and is designed very similar to .NET while kohana uses more old school concepts instead of inheritance to achieve same results. Personally I think yii is a much better framework and much easier to understand and grasp than kohana. I would not even consider kohana when u have yii and code igniter for simpler stuff. If u look at the core kohana code and compare to core yii code the argument for yii becomes clear. If you don’t have a very good grasp of OO then perhaps kohana is the better choice or could just go with CI because it has a much bigger user base than kohana.

Well, Yii is a framework and Kohana is more like a toolset.

It’s difficult to compare the two.

Kemal obviously prefers to write the glue code himself, thus having a preference for Kohana.

That’s what it is: a preference.

From what I’ve seen of Kohana code, it’s neat and modern.

If you want to compare anything, compare Kohana and CI with Zend.

And compare Yii with CakePHP and Symfony.

IMO. ;)

I ended up not comparing Kohana to Yii but talking about features that make Kohana as good as it gets.

Posted the presentation slides on slideshare, in case that anyone here cares :P :

I tried to read that slides, I closed the browser tab when I’ve seen “Speed - So fast that no one seems to benchmark against it”, ahaha… “speed” or “insignificance”? Uh ok :)

Kemal, presentation is a bit evangelistic… pros are there, cons aren’t. For example, it’s said about documentation that it’s all in one place but not mentioned that Ko3 guide sucks. Really. I don’t want to be offensive but it’s behind codebase for months and there a lot of TODO marks. Again, “elite community” really means that Ko forums isn’t a friendly place. Compare Yii vs Ko topics at both forums ;)

Anyway, thanks for sharing. Second slide is nice ;)