"Yii" just contacted Yii to talk about the views and feelings about the Yii framework (Yii 1.1.x)
This post was last edited by default7 on 2014-06-10 00:57:13
The reason why you want to get yii, because see a lot of recruitment PHP requirements must be proficient in the YII framework.
The first impression of the framework is the founding of the Chinese, but it is all English-based. These days I looked at the authoritative guide for Yii.
Describe your initial experience (Yii 1.x):
1) file structure is messy.
Since it is a framework, you can/protected/controllers/post/createaction.php the action independently. This makes it extremely easy to confuse action with controller.
2) The control of the view is too strong, the template uses pure PHP. Do you have to be a programmer to write the front end?
A Web site project, let the artist cut out the HTML DIV CSS template, and let the PHP programmer to replace the HTML tag inside the PHP tag again?
The cHTML of Yii makes many people particularly raving, but they seem to overlook one of the most core key, the website Web page function No presentation It's going to be miserable., you don't expect visitors to be like programmers who just like square boxes without a picture that is all tabular and honorific.
To note: Web pages He does not like software, software may be a few more than 10 years to do the functional improvement, but the Web page, visitors like freshness, interface vision, so need to constantly change the interface, change the UI.
is regularly modified, three days a small change, one months a big change, three months to re-change. The interface needs to be changed frequently. In this case, if you use the HTML prototype directly to do the template, the art of the div can be used directly after the application, there is no need to program intervention. But if you use cHTML like this,
highly coupledView (template), it must be
an extra process, is it necessary for a programmer who knows yii to turn the finished div html into a tag in the Yii view template, so it's not a waste? Human, time, and financial resources. Efficient and fast back-channel with PHP?
In fact, Yii's official website is also very primitive, why Apple will succeed, presentation is the key, now the UI interface is really too important.
3) Feeling the coupling between the various is too high, like a new language.
Yii entry threshold is much higher than other frames. Each is highly coupled, with configuration-like settings, the more tightly coupled, the more fragmented the profiles are in fact, the more expensive, longer, and less maintainable (of course, he may run quickly).
the attraction of Yii to me:
1) 51job, Zhaopin on many of the requirements of PHP programmers need to master yii (in fact, see those requirements I feel very strange, the description will be able to independently complete a project and master Yii and the end of the Div CSS UI, want to let someone else, a little unrealistic, Yii is suitable for large projects, and is it not ridiculous for a large project to have the programmer do yii and let him write the div again? )
2) Online many times are filled with the praise of Yii, recommendation, such as knowledge on the search engine in the MVC framework rankings see the major reproduced articles, PHP MVC framework rankings, Yii are ranked very before, and many gods praise.
The above is my initial contact with Yii some feelings, write to hope to be able to explore together, the purpose is to be able to grasp and understand faster. by default7#zbphp.com
------Solution--------------------
Welcome to understand Yii2.0, most of the problems you say in the Yii 2.0 era have been better achieved.
As for the use of PHP template, this belongs to the question of the benevolent see of the beholder. Learn template engine and learn PHP is not much difference. 2.0 native support Smarty and twig
As for the problem of coupling, as long as you think, decoupling is not a problem, Yii provides a one-stop solution, a word, is fast, after you want to replace components, templates, plus cache, as you like. 2.0 native supports a variety of decoupling, such as Di.
As for the problem of new languages, because yii used a lot of DSL patterns. This model was invented by Microsoft. Why use, because good.
As for the problem of chaos, you did not learn activerecord, useless to use the activeform. The combination of these things is the core of the modern PHP framework. These features of the point you did not say that the use of good efficiency gray often high. Yii2.0 new query and performance separation of the activequery and more hanging multi-relational query, the time to understand the next.
In addition to the features of security design, GII code generator, Developer toolbar, debug mode, Codeception debugger, fixture data customizer, Bootstrap extension and many other features, the learning curve itself is not a problem, these features you do not have to be okay, When native PHP is used as well, but the learning curve is proportional to the income, use you will not let go.
Kung Fu to go down, you don't mean it can't, so many enterprises with Yii, is their CTO silly?
------Solution--------------------
You only see the shortcomings of Yii, did not see the advantages of YII2. Any framework will have drawbacks.
1, the main essence of Yii is oop.
This is where the entire functionality of the YII framework is located and is the main reason for the company's recruitment
2, as the above-mentioned YII provides a variety of convenient functions, so the development speed.
3. Messy file structure
It's all organized according to your personal habits, you can write it like this.
Protected
Actions
Post
createaction.php
readaction.php
Controllers
postcontroller.php
4, as to the form problem
This depends on personal needs, if you do the form page is very acceptable, you can use ActiveForm.
Of course, you can do without activeform, write your own HTML to achieve, ActiveForm just provide you with a convenient.
------Solution--------------------
I didn't use Yii, and I didn't plan on using it. Indicates no employment pressure
It is said that Yii2.0 can work in PHP 5.4 and above.
So in the template
The criticism on Yii templates, which is the criticism of Smarty, is the criticism of all the frameworks that use the template engine to separate the business logic from the view, that is, the design pattern of MVC.
Let's say, credence
If you want to introduce a control flow in a template, it's better to use PHP code like YII, rather than creating a set of template languages like Smarty
At least it is difficult to learn, not to mention the learning of PHP, eating has finally fallen
I would like to have a framework in which he can translate the PHP code that is declared as a client in HTML into a JS code. thereby eliminating the need to learn PHP and learn JS trouble
------Solution--------------------
Personally think that there is no reason, you say the points are only a function provided by the framework
1) file Structure Messy: framework has forced you to write the action separately? It can be written to the Controller.
2) The control of the view is too strong: and the first one, no one forced you to use this function, I do the form to see if the situation is enabled ActiveForm, which is convenient to use which
It turns out that the formal company is the division of Labor clearly will not let the art to dry front-end staff slicing, or even let the art or front-end to set procedures, only those who compare the pit of the network construction companies, non-formal companies will do so, out of a person's salary to do several types of work
The framework is just a productivity-boosting tool to see how you use it, not to let you use all of the built-in features, not to be framed!
------Solution--------------------
As for cHTML do form activeform, can not be used. But the best thing about Yii is that it's OOP and MVC, and the soul of it: it's the efficiency of having all the classes loaded in with it instead of running it! It is also the reason why many enterprises require yii.
------Solution--------------------
With Yii completed 2 projects, is doing a third, this time the project is relatively large, more functions.
The first two projects once with others, a completely self-made, do one of their own is to do a ticketing system, because the overall interface requirements are not high, I did not find the front end, all of their own writing.
Now feel that the overall design of Yii is very comfortable, and its own component-based framework makes it highly customizable, like upstairs, there are a lot of features you feel bad Nani can do without, there are many alternatives, yii just give you a choice, If you feel like there is no alternative but to show that you are not familiar with the framework, the individual feels that Yii is worth delving into.
------Solution--------------------
Yii is a bit complicated for beginners, but it is a very good framework to realize the benefits in a long time. At first may not feel, wait until the later maintenance time can be found, it is really convenient, very flexible, how to change how to change, even if the demand changed, with it can also be completed quickly. Of course, if you have to make sure the design is reasonable.
------Solution--------------------
1) file structure is messy.
Since it is a framework, you can/protected/controllers/post/createaction.php the action independently. This makes it extremely easy to confuse action with controller.