On Wed, 2010-09-15 at 14:37 +0300, Vlad Dragu wrote:
> * You need to serialize the whole Mission class
> [Vlad] I understand, I will do that
Thanks!
> * To do this, you need to split Missions in two classes
> [Vlad] ok, I’m working on it. I will post it to the repository tonight
> and you can tell me if it’s in order or needs additional modifications
Yup, I'll have a look. Not sure if I will have the time to look at the
code before Friday, but if you want to check just post a link to the
part of the code you'd want to have comments on, I'll try to take care
of it tomorrow.
> * $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)
>
> [Vlad] the site data is already implemented as a class. After I
> instantiate the site object I hold it in the $site_data variable. If I
> don’t do that, I will have to instantiate a new site object each time
> I need a property of a site. Is that efficient?
Ah, my mistake, sorry - I didn't look carefully enough here. I assumed
from the name (*_data) that it was like for the session.
> for the $play_data variable I do not have the class implemented.
> Basically this holds the user/session info, and implementing this in
> object model will take a significant amount of time. Should I start to
> work on this now?
Yup, that's an issue. If it takes you a lot of time, I don't think you
should start changing this now. Maybe it's a good time to start having a
hard look at the code structure, and maybe spend the necessary time
during one of the next iterations to update the code and make it match
the totality of the requirements (OO, no globals, data objects, etc.).
Otherwise this will increasingly become an issue.
If you had to do this, how much time would it take you?
> * "New features must be implemented in object-oriented model and
> must not use global variable."
> [Vlad] once I serialize the whole mission class, this should be easy
Great!
> [Vlad] I can move the construct in the abstract class. There is a
> problem with moving the clear_action() function. This function is not
> automatically called regardless of the circumstances. For example, in
> the function home_hacked I have a couple of conditions. If they are
> not met, the function returns false and the action is not cleared (the
> mission still waits for the same action). This is why I don’t think
> that moving the clear action to the constructor will work
Do you the false return value? Because that can be what prevents the
action to be cleared when an action is triggered. When you call the
corresponding method, you could:
1. Remove the action from the queue (to prevent the user to trigger
the same action twice if the method takes some time to be
executed)
2. Call the method
3. Look at the method return value - by default do nothing, if
false re-add the action to the queue (with the same flags and
everything - so you probably want to store the action details
before removing it from the queue in 1.)
Or am I missing something?
> * This will allow you to store the content of variables such as
> XXX
> [Vlad] not sure what is this referring to
You can ignore this - just something I forgot to remove from my
draft : )
> * 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.
> [Vlad] both give_reward and replenish_points functions are linked to
> the user/session tables. And for me to use data object I must first
> implement the user class. Or am I missing something here?
You could probably attempt a partial implementation at first, by just
building the necessary data object. But this is linked to the above
discussion.
> [Vlad] in the final version the $_GET will not be used. I had to use
> it for now in order to have the test file going. If you look in the
> code, you will see that the correct final code is commented out.
I see - no worries then.
> [Vlad] I’m always looking to learn new things and looking at the TOC
> of the book I think I can learn a great deal from it. Thank you.
You're welcome - it's always a lot more interesting to work on new
concepts that makes us learn new stuff, so I'm happy that the work on
HackIt can provide that!
I'll have a look at the Safari offerings and get back to you.
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