One thing I think that would really help is to have a Moodle Module developed with developers in mind. Some where that encourages tinkering and learning as you develop. Particular areas that developers seem interested in at the moment are performance, unit testing and my pet focus separating the view from the back ground code much like an MVC structure.
I've been programming for several years in asp and javascript where we didn't have debuggers and other wonderful kit to help us and there wasn't anything on the web either. So I've built my own toolkit that helps me lift the lid on my code and try things out.
I planning to provide a set of classes with set of template scripts which show how they're used. All a developer needs to do is:
- Copy the template
- Add the code to test
- begin testing using the toolkit
testLoop.php
<?php
require_once setup.php;
$profiler = new Profile();
$out = new Out();
// Begin test code
$arr = array("one", "two", "three");
reset($arr);
$limit = 1000;
var $x;
var $string = '';
// test while
profiler->beginstep('while');
for($x=0;$x<$limit;$x++){
while (list(, $value) = each($arr)) {
// Do something
string.= "Value: $value<br />\n";
}
}
$profiler->endStep();
// Reset test values
$x=0;
$string = '';
profiler->beginStep('foreach');
// Test foreach
for($x=0;$x<$limit;$x++){
foreach ($arr as $value) {
// Do something
string.= "Value: $value<br />\n";
}
}
$profiler->endStep();
// End test code
$steps = $profiler->getSteps();
$out->append('The test took '.$profiler->getElapsedTime().' seconds.');
foreach(steps as step){
$out->append('Step '.$step->getName().' took '.$step->getSeconds().' seconds.');
}
out->flush();
require_once teardown.php;
?>
I'm showing php code here but I have found very quick and simple methods to help with:
and others. I'm also always learning from other people and with so many helpful people on these forums I'm sure there are lots of tips we can all share.
So I just wanted to see if this would be of interest to any one and if any one has any input they'd like to give. I think it would be a great way to improve the quality of the code we currently have while making the process fun and enjoyable by hopefully making it simpler.