https://bugzilla.wikimedia.org/show_bug.cgi?id=22018





--- Comment #2 from Martin Keckeis <keckeismar...@hotmail.com>  2010-01-05 
13:00:00 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> > Hello,
> > 
> > i am a PHP developer (since about 2004) and working as a softwaredeveloper.
> > I want to help mediawiki (especially the readability of the source) getting
> > better.
> > 
> > But first off all here are some suggestions (what i would rewrite first):
> > * The coding conventions are very "holey" (maybe take a look at
> > framework.zend.com which are much better)
> 
> We do follow the Zend convention for some things. Other things we have our own
> preferences.
> 
> > * If the Classnames, Filenames, ... would have a good convention -> 
> > autoloading
> > would get easy and lines like "require_once(...)" are mostly history
> > (performance is also better, because the class is only loaded when it's 
> > needed
> > and not on suspicion that it's needed)
> 
> We already use an autoloader.
Yes but this class is not very "good". Every path is WRITTEN there -> this
means for every new class you need to edit this class...so the "automatic"
thing is lost.
> 
> > * " are only used for SQL statements, because ' is faster
> 
> A common misconception. They're roughly equal for all intents and purposes.
Are u sure? If u use echo "asdfsd $VAR asdf asdf " the compiler has to walk
through the whole ouput string and search for variables. if u use echo
'asdfsd'. $VAR .'asdf asdf ' the compiler don't have to! --> It's not much but
when u look at how much pageimpressions wikipedia has, where would be a slight
performance improvement.
> 
> > * replace print with echo 
> 
> See above.
What does that todo with above? It's not recommended to use 2 functions for
output, for 2 main reasons: 
* The readability gets lost
* if where is an error in both of this function you would have to check both
(very unlikely i know)
* if sometime PHP has another/better output function/class you would have to
change both and not only one
> 
> > * old classes: methods are not declared as public / private and so on
> 
> We clean this up as we go along. It's not safe to just start tacking private 
> on
> things.
> 
> > * one class = one file (not more than one class in a file)
> 
> Personal choice. We follow this for the most part. Tiny classes for a single
> purpose can get tacked on if they're relevant though.
* Then u load maybe unnecessary code with autoloading.
* If u want to include a class u can't read this class in the filename (only
the mainclass)

> 
> > * use docblock for classes so all classes could get documentated in phpdoc 
> > or
> > something like that
> 
> We do this in newer code and try to document as we go along.
> 
> > * reformat every file with the formatting standards
> 
> It happens when people get to it. Massive cleanups all at once lend themselves
> to mistakes.
* If u reformat a file -> what can happen?
> 
> > * a good "flow diagramm" where u see: first index.php, which includes this 
> > and
> > this files, ...
> > * ...
> 
> Would be cool on MediaWiki.org, if it's not already documented.
> 


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to