Welcome, Guest
Username: Password: Remember me

TOPIC: [CLEANED] Some optimisation

[CLEANED] Some optimisation 24 Jan 2012 14:53 #1041

  • M4d3L
  • M4d3L's Avatar
  • Offline
  • Senior Member
  • Posts: 45
  • Thank you received: 7
  • Karma: 3
1- some variable are generated but not use.

ex: In the display function of my view
$app = &JFactory::getApplication();
$option = JRequest::getCmd('option');
$user =& JFactory::getUser();

I think you must add some kind of control to not add these for nothing. Only when needed.

2- Use JParameter instead of your getParams function in the view.html.php
$paramsdefs = JPATH_COMPONENT.DS.'models'.DS.'MODEL_NAME.xml'; //not require
$params = new JParameter( $row->params, $paramsdefs );

3- Dont use DS define. but DIRECTORY_SEPARATOR instead. It's a bad practice to use DS. (specially when auto-generated)

More to come later :P
Last Edit: 24 Jan 2012 15:01 by M4d3L.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Some optimisation 24 Jan 2012 15:12 #1042

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Thank you for all your suggestions.


Why DS a bad practice ?

'DIRECTORY_SEPARATOR' is very long string. Then the code is difficult to read.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Some optimisation 24 Jan 2012 15:23 #1043

  • M4d3L
  • M4d3L's Avatar
  • Offline
  • Senior Member
  • Posts: 45
  • Thank you received: 7
  • Karma: 3
1- descriptive names are always better than variables like $a, $b, $d etc...
2- aliasing constants that describe what they are into a meaningless two letters?
3- why use more memory space for a slash (/)? Most recent system support the / today.

and like I said. its only for optimisation.
The administrator has disabled public write access.

Re: Some optimisation 24 Jan 2012 15:52 #1044

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Ok for optimisation, but today, PHP servers are very fast and it is not a problem of memory.

But for this particular point, I keep DS.
In JDom I created also BR in order to write "<br />" in a fast way.

But even if BR is not very useful, DS is very important because windows servers use '\' for directories.


By the way, I tell the users of the forum to NEVER use DS when you are composing urls. ;-)
Seems obvious, but I ran in the mistake so many times.


Lot of Cook users are beginers and I wanted to create a system who answer the needs of professionals AND beginners.

I know also the MVC could be more compact (when I see how it is constructed in 1.6), but to my opinion, the names of the functions are not intuitive and more difficult for beginners.

Same for JDom :
Joomla can handle such types of fields, but it is SO difficult to override/custom and to undersand for beginners.

Cook Self Service respects fully (I think) the standards, in a simplified coding manner, even if sometime you can find repetitions in the source code. It is much more easy to debug and to understand the stack if you want to write inside. It is our politic.


I really appreciate your feedbacks, you are one of the first who gave me an opinion about the generated code.
Karma +2
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Some optimisation 24 Jan 2012 17:37 #1048

  • M4d3L
  • M4d3L's Avatar
  • Offline
  • Senior Member
  • Posts: 45
  • Thank you received: 7
  • Karma: 3
hehe no problem, I like your tools. it's actually the most complete I seen.

and I only checked a small % of your generated code on a small and basic project.

I have more big project coming so I will improve your Builder ;)

Do you plan tol add functionnality to add our own field validation and type and setup our own toolbar button sometime?
The administrator has disabled public write access.

Re: Some optimisation 24 Jan 2012 17:57 #1054

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Yes, but step by step... So much work to do it present moment.

Custom toolbar for example if the task alias is 'run', it will create the empty run() function in the MVC files with 3 possible level of depth.

- Controller + Model + Table
- Controller + Model
- Controller


Field validator is already available. You can enter you own regex in the builder.
Maybe I didn't understood the question.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: M4d3L

Re: Some optimisation 24 Jan 2012 17:59 #1056

  • M4d3L
  • M4d3L's Avatar
  • Offline
  • Senior Member
  • Posts: 45
  • Thank you received: 7
  • Karma: 3
oh well its me that didnt see it I think :P
The administrator has disabled public write access.

Re: Some optimisation 09 Mar 2012 15:02 #1537

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
All cleaned
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.078 seconds

Get Started