The keys to future aiki success is simplicity, modularity, clarity, and
sturdiness.

Modularity.
=======
For example, a simple function that return a id for a given widget-name or
widget-id permits in few lines:
- widget calls by name in all aiki
- control better widget names convention,
- control access to widget by user group in all wiki

Avoid code as widget.php (the core of aiki) with method that have more than
1000 lines: untestable!!

------ example of modularity -----
private function get_widget_id($widgetNameOrId){
       //Fictitious example...don't work.
        global $db,$aiki;
        if ( (int) $widgetNameOrId > 0 ){
            $field= "widget_id='$widgetNameOrId'";
        } else {
            $field= "widget_name='" .str_replace("'","",$widgetNameOrId)
."'";
        }
       $groupID= $aiki->membership->group_id();
       $searchSQL=
            "SELECT id FROM aiki_widgets ".
            "WHERE widget_{$field}
            " AND is_active='1' ".
            " AND (grouplevel=0 or  grouplevel=$groupID )
            " LIMIT 1" ;
        return $db->get_var($searchSQL);
    }


Clarity in little things
===============
aiki class must be defined in aiki.php not in core.php
widget.php  must have a class called widget. Other, called layout.
configs/config.php must be config file or renamed as
configs/config-template.php
A variable must be one purpose. For example
   $widget_id = explode("|", $data); //now widget is a array.
   $widget_id= $$widget_id[1]; // now a integer...
.....
Hidden hacks must be avoid ( or prosecuted!!!):
do you know that widgets.normal_select admits two sql separated by |OR| and
the second will be used if the first return no result?
Why normal_select is parsed by L10?
why a widget that contains <form></form> is not parsed by our php script?
what is the fourth argument in (#(form:...)?
what are the difference between (#(widget:97)#) and(#(inherit:97)#) ?

sturdiness.
==========================
For example, admin interface depends of AJAX. Links are like : <a href="#"
rel="things-i-do">(1).If something go bad., how can you trace the error?
other example: put a deliberate error in /assets/apps/admin/urls_widgets.php
and try found it..

We are using ajax in the wrong direction. If link are like <a
href="/url/list/" rev="div-where-i-must-appears">(1), we can ajaxify calls,
but if something go bad is more simpler see where is the error (deactivate
javascript)


Conclusions
=========
realization of new ideas depends on change our programing style. Then, the
priority must be:
- refactor widget and  forms.
- robust admin interface
- new update procedure.
So..basically we are in the good.



(1) see http://www.aikiframework.org/wiki/Aikimarkup
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to