[Yii] I am new to Yii and want to talk about my views and feelings on the Yii Framework (Yii1.1.x). This post was edited by default7 from 2014-06-1000:57:13, as we can see, many PHP jobs require that you be proficient in the Yii Framework. First, I was impressed that this framework was created by Chinese people, but it is dominated by English. I have read Yii permission over the past few days. [Yii] I have just come into contact with Yii to discuss my views and feelings on the Yii Framework (Yii 1.1.x)
This post was last edited by default7 at 00:57:13
The reason why I want to get Yii is that many PHP recruitment requests must be proficient in the Yii Framework.
First, I was impressed that this framework was created by Chinese people, but it is dominated by English. I have read the Yii authoritative guide over the past few days.
Let's talk about your initial feelings (Yii 1.x ):
1) the file structure is messy.
Since it is a framework, you can separate the action from/protected/controllers/post/CreateAction. php. This can easily confuse action and controller.
2) there is a strong desire to control the view. The template uses pure PHP. Do you have to write the front end as a programmer?
A website project allows the artist to cut out the html div css template, and then let the PHP programmer switch the HTML tag inside to the PHP tag for another trip?
The CHtml of Yii makes many people fully praised, but it seems that they have ignored the key to the most core. it will be miserable if the website has functions that are not sold out, you should not expect that visitors will like programmers who only like square frames. no picture is full of tables and neat pages for the workers.
Note: Unlike software, a website may improve functions over the past few years. However, visitors like freshness and UI vision. Therefore, you need to constantly modify the UI and change the UI.
It is a regular change, with a minor change in three days, a major change in one month, and a change in three months. The interface needs to be changed frequently. In this case, if you directly use the html prototype as the template, you can use it directly after the artist completes the DIV, and you do not need to intervene in the program. However, if CHtml is used
Highly coupledView (Template) writing, you must
One more processThat is, a programmer who understands Yii needs to convert the div html prepared by the artist into tags in the Yii view template. isn't that a waste? Manpower, time, and financial resources. And PHP's efficient and fast backend?
In fact, Yii's official website is also extremely simple. Why did Apple succeed? selling is the key. in this era, the UI is really too important.
3) I feel that the coupling degree is too high, just like a new language.
Yii has a much higher entry threshold than other frameworks. The configuration files are highly coupled and configured in the same way. The closer the coupling is, the more scattered the configuration files are. In fact, the higher the maintenance cost, the longer the time, and the lower the maintenance efficiency (of course, it may run very quickly ).
Yii's attraction to me:
1) 51job and Zhaopin require many PHP programmers to be proficient in Yii (in fact, I find it strange to see the requirements, in terms of description, Yii should be able to independently complete the entire project, be proficient in Yii, and be proficient in div css ui. Yii is suitable for large projects if it is not practical to let others do it by themselves, isn't it ridiculous to have a programmer do Yii and write DIV in a large project ?)
2) many of the power of the Internet is filled with praise and recommendations for Yii. for example, Zhihu and search engine search for MVC framework rankings see major reposted articles and php mvc framework rankings, yii is well ranked and praised by many others.
The above are some of my initial experiences with Yii. I hope that I can discuss them together, so that I can grasp and comprehend them more quickly. By default7 # zbphp.com
------ Solution --------------------
Welcome to Yii2.0. most of the problems you mentioned have been better implemented in the Yii 2.0 era.
As for using PHP as a template, this is a matter of benevolent and wise. Learning the template engine is not much inferior to learning PHP. 2.0 native support for smarty and twig
As for coupling, as long as you think, decoupling is not a problem at all. Yii provides an all-in-one solution. one word is fast. then you want to replace the component, modify the template, and add the cache, follow suit. 2.0 native supports multiple decoupling methods, such as DI.
As for the new language, Yii uses a large number of DSL models. This model was invented by Microsoft. Why, because it is easy to use.
As for the chaos, you didn't learn ActiveRecord, and didn't use ActiveForm. Matching these things is the core of the modern PHP framework. You have not mentioned any of these special points, so it is very inefficient to use them. Yii2.0 adds a new ActiveQuery with separated query and performance, and a more hanging multi-link query.
In addition, the features include security design, GII code generator, developer tool bar, debugging mode, Codeception debugger, Fixture data customizer, Bootstrap extension, and so on. The learning curve itself is not a problem, it doesn't matter if you don't need these features. if you use the same native PHP, you can also use them, but the learning curve is directly proportional to the benefits. if you use them, you won't be able to let it go.
You don't mean it doesn't mean you can't. so many enterprises use Yii, isn't their CTO stupid?
------ Solution --------------------
You can only see the disadvantages of yii, but not the advantages of yii2. Any framework has disadvantages.
1. the main essence of yii is OOP.
This is the entire function of the yii Framework and is also the main reason for recruitment.
2. as yii mentioned above provides a variety of convenient functions, the development speed is fast.
3. messy File structure
This is organized according to your habits. you can write it like this.
Protected
Actions
Post
CreateAction. php
ReadAction. php
Controllers
PostController. php
4. form problems
This depends on individual needs. if the form page is regular, you can use ActiveForm.
Of course, you don't need to use ActiveForm. you can write html to implement it. ActiveForm only provides you with a convenient way.
------ Solution --------------------
I have never used Yii, and I am not planning to use it. No employment pressure
It is said that Yii2.0 can work in php 5.4 or above.
Therefore,
The author criticized the Yii template, namely, Smarty, and all the frameworks that use the template engine to separate the business logic from the view, that is, criticism of the MVC design model.
Just listen
If you want to introduce the control flow in the template, it is really better to directly use php code like Yii than to create a template language like Smarty.
At least the learning difficulty is reduced, not to mention learning php and eating have finally fallen.
I expect a framework that translates the php code declared as a client in html into js code. This frees you from the trouble of learning php and js.
------ Solution --------------------
I personally think there is no reason. what you are talking about is just a function provided by the framework.
1) messy file structure: Does the framework force you to write the action separately? You can write data to the Controller.
2) the desire to control the view is too strong: like the first one, no one forces you to use this function. I make my own forms to see if ActiveForm is enabled. which one is convenient to use?
Facts have proved that regular companies all have clear division of labor, so they won't let the artist do the front-end staff slicing, or even let the artist or the front-end install the program, only online construction companies and informal companies that are relatively pitfall will do this. they will make a person's salary and work on several types of work.
The framework is just a tool to improve work efficiency. it depends on how you use it. instead of letting you use all built-in functions, don't be framed by the framework!
------ Solution --------------------
As for the form ActiveForm of Chtml, it is usable. However, I personally think that yii is the best in OOP and MVC, and has the soul of it: it can be used as needed. instead of running, it can load all classes, this is also the efficiency! This is why many enterprises require YII.
------ Solution --------------------
Two projects have been completed with Yii, and a third project is in progress. this project is relatively large and has many functions.
The first two projects work with others at a time, and they do exactly what they do at a time. They do a ticket system at a time. because the overall interface is not highly demanding, I didn't find a front-end, all are written by yourself.
Now I feel that Yii's overall design is really comfortable to use. its component-based framework makes it highly customizable. as mentioned above, there are a lot of functions that you don't think Nanni can use. There are many alternatives. Yii just gives you an extra choice. if you don't think there are any alternatives, it only means you are not familiar with the framework, I personally think Yii is worth studying.
------ Solution --------------------
Yii is indeed a little complicated for beginners, but it will take a long time to realize the benefits. it is indeed an excellent framework. At the beginning, I may not feel it. I can find it very convenient and flexible when I wait for later maintenance. I can change it if I want to change it, even if the demand changes, it can also be used quickly. Of course, the premise is that you must ensure that the design is reasonable.
------ Solution --------------------
1) the file structure is messy.
Since it is a framework, you can separate the action from/protected/controllers/post/CreateAction. php. This can easily confuse action and controller.