We have to adapt user_find.php to produce an output if submit is_set else it should produce a drop down list. Simple enough
My question is what is oop4.php needed for? Does it simply point to user_find.php? Or do we have to echo the form on oop4.php and have it submit to user_find.php? The latter seeming a bit clumsy.
Secondly oop5 requires us to adapt user_find.php once more to produce a different output. What then do we call this second modified version of user_find.php? user_find_oop5.php?
Would it not be simpler to copy the contents of user_find.php into oop4.php and oop5.php and do away with the two versions of user_find.php?
Finally, for oop5 we need to create a new user_friends table in the database with modified associations.
I can call this new table user_friends_oop5 for example, but that would require me to adapt the function getFriends in user.php so that it selects friend_id from user_friends_oop5 instead of from user_friends.
I don’t like the idea of changing the class just for oop5. Should I just create another database with a users and modified user_friends table?
Registered: 13 years ago
Well, there you go The two pages are provided (and named) to make it easier for students to understand the logic and the requirements. It does not say how you must use it, other than what needs to be adapted where. Nothing stops you from incorporating user_find into user or the other way around (this should be apparent from ICT2613 requirements).
Regarding the new table and your statement that you do not want to change the class just for oop5. But this is at the heart of oop - that you use a previous class as is and extend it with a child class,and override the methods in the previous class. And if that gets too complex (it quickly can and one reason why I will never agree to a semester courses for PHP and try and provide challenges that at minimum helps you understand the syntax), then you just create new tables (not a new database!). One thing I know is that you will try different things and that is good because so you learn.
Registered: 13 years ago
Just in case others start to panic - you do not have to, but it will demonstrate learning has taken place and you will be rewarded accordingly. These type of approaches come with experience (the syntax itself is the initial focus), but it was specifically highlighted because it leads to better coding practices, something which we unfortunately cannot cover in a semester