Ideas for Yii 2.0

Yii by its self is a peaty good in many ways but always something that would cool to have.

I have few ideas that developers might consider implementing in future.I don’t claim my ideas are what shoud be done, its just thoughts for all who interested in development of yii.

First thing in mind that came to me when working with yii that its MVC are darn fast in all meanings, when it works nor on develop stage.Most of time in fact 80-90% im perseanaly spending on combining visual design and all logic, MVC shure helps View concept are nice, but when i got complicated layout’s from designer its nightmare to create views from it. What i have in mind is some kind of tool, call it Vii (visual ii or, View ii or Vi i,) like Gii for CRUD and stuff or even part of Gii, that have several function

[list=1]

[*] Import new design or skin (if you create some design by some rules so it can be used by yii natively)

[*] Let you create basic layout change (generates new /view/layeout/main and other columns, rows so on.

[*] Edit ,elements,columns, place, size,colors,etc in layout.

[/list]

next thing for 2.0

its more development thing.

create configurations for application

[list=1]

[*] development/debugging/testing

[*] Benchmarking/Optimizing

[*] Production

[/list]

each stage have special configurations in app.

Development stage

when application in this stage, there is information about elements in balloons where leading what, who belongs where and who influenced on this object and of course all traces and stuff.

Debugging, trace of changes of particular variables or objects.

Testing, just results of all tests on some separate view where is errors what parts of code is not covered, etc…

project managementbasic application task management or assignment for parallel development when you can see potential cross of code, or just list of @todo’s tags from code.

Benchmarking/Optimizing

This part is all about bottlenecks, what part of application code is most slow, or memory eating segment

some advices there would be nice to.

Production

On this stage it can be aromatically published or created public version even compiled with PHC.

Next major thing i that about is some kind of work-cloud i cant figure out how to call it but idea is that

when you start application its launching its create a some kind of state that describe all application elements and there states.And all you have to do as developer define smaller actions that modify state of application.

in another words, if there variable $a that defined in some controler you can write

function IncA() {

$curent_value_of_A= $this->getControlerByName(‘Message’)->a;

$this->getControlerByName(‘Message’)->a = $curent_value_of_A +1;

}

and if user on web site click several times on a button that have call this IncA, then $a would incremented in click count amount.

another example

2 buttons on page,

when press on one, this function is called

FirstButonClick($sender){

$this->button2->visible=false;

or $this->button2->hide();

}

guess what happen next.

with ajax its possible even without reloading,

next thing its possible to modification elements of application that not visible at all or don’t exists yet.

Thank you, any questions or comments are welcome.

(admins Is it time to create forum part for Yii 2.0 descution?)

I would offer to convert private fields to protected - to let people override the default behaviour if they want to.

As for the framework there are too many private fields around in the end-user classes like CHTML




I would offer to convert private fields to protected



Do you offer convert it all???

I think that for the conversion of at least one private variable should be a clear rationale and each of them should be discussed separately, should be examples of why it took.

agree

Was lot of time developing\thinking with\about yii.

As result i have one more thing to consider.

First time when i meet yii i think that using array as grouping method for configuration of items is something like whim or just necessity thing.

But then i start imagining why i have strange filing that its not very good, and what can i offer.

So here is thing:

if you create any object in Yii anything that need anything that need array as parameter.

so why use


$object->param = array('parameter'=>'value','param2'=>'othervalue');

instead of that use:




$object->parameter = 'value';

$object->param2 = 'othervalue';



What im saying that all object should be objects that accessible as real object.

I’ve noticed that it would be extremely helpful if the core classes had interfaces associated with those core classes. The reason why is because when we graft 3rd party libraries into our projects, it is often necessary to use an adapter pattern to ensure that the libraries are not tightly coupled.

I’ll give an actual use case for example. I’m developing a web application that uses Yii as the MCV framework but Doctrine ORM as the persistence layer.

In order to have the forms persist the the backend I’ve added classes that act as adapters so I can take a Yii CFormModel and use it to persist the data with the Doctrine ORM entity. This is not difficult to do, in fact it’s easy with Yii, but one sticking point is that I can’t set an inherited type for the adapter constructor to typehint that it needs to be a Yii CFormModel class.

Here’s a code example:


<?php

namespace myApp\Vendor\Yii\Adapter;


use MyApp\Service\Users as UsersService;


class RegistrationFormAdapter 

{


    public function __construct(UserService $service, $form) {

        //..code here

    }


}

Ideally it would be better if It could be like this:


<?php

namespace myApp\Vendor\Yii\Adapter;


use MyApp\Service\Users as UsersService;

use CFormModelInterface as YiiFormModel;


class RegistrationFormAdapter 

{


    public function __construct(UserService $service, YiiFormModel $form) {

        //..code here

    }


}

And it would be best if it could be like this:


<?php

namespace myApp\Vendor\Yii\Adapter;


use MyApp\Service\Users as UsersService;

use Yii\Web\FormModelInterface as YiiFormModel;


class RegistrationFormAdapter 

{


    public function __construct(UserService $service, YiiFormModel $form) {

        //..code here

    }


}

Closing this since we now have Yii 2.0 forum: http://www.yiiframework.com/forum/index.php?/forum/42-design-discussions-for-yii-20/