Hi,

I've just spent some time looking at the mission code for alpha2.0. I've
said good things about it, now come the nitpicking :D


      * You need to serialize the whole Mission class, not the
        individual Mission variables; otherwise you would need to change
        the mission engine code every time we would need an additional
        variable in the mission (like hints); see
        http://www.php.net/manual/en/language.oop5.serialization.php
        (classes/class_missions.php) 
      * To do this, you need to split Missions in two classes: the
        Mission abstract class, and the MissionsEngine. The second one
        will hold a list of the missions and their instances, create and
        call individual missions, save mission objects and restore them,
        keep track of the action queue... 
      * $play_data and $site_data don't belong as variables in missions
        class, you should create a specific class for each of them
        (classes/class_missions.php)
      * The mission engine makes use of global variables through
        $_SESSION - cf requirements: "New features must be implemented
        in object-oriented model and must not use global variable." 
      * The logic in First_mission->__construct() needs to be moved to
        the abstract class Mission, otherwise it will have to be
        repeated in each mission file. This logic should also call
        $this->clear_action() before calling the method for the action,
        otherwise it has to be repeated in each method
      * This will allow you to store the content of variables such as
        XXX
      * As discussed previously, you need to do SQL requests through
        data objects - so you need to change methods such as
        Missions->give_reward() or Missions->replenish_hackscan_points()
        that don't follow this requirement. 
      * Good job on the code documentation, it's very good now
      * Same remark about the Changelog, it's perfect
      * in First_mission->getting_an_isp_website_finding_it(): instead
        of using $_GET['tag'] which is not safe, you should access a
        First_mission->session->current_site object 


A lot of these issues are natural when you switch from a functional to
an object orientation. If you want and if it helps, you can chose a good
book about Object Oriented programming with PHP and I'll order it for
you. Or I could open an account for you on
http://my.safaribooksonline.com/ - there is for example that book that
seems interesting: http://my.safaribooksonline.com/9781590599099 . Just
let me know if you're interested!

Xavier.
_______________________________________________
Hackit Bar mailing list - [email protected]

Wiki:  http://community.hackit.cx/
List:  http://community.hackit.cx/ml/
Forum: http://community.hackit.cx/forum/
Ideas: http://community.hackit.cx/ideas/
IRC:   irc://irc.freenode.net/#politis

Reply via email to