Welcome! Log In Create A New Profile

Advanced

Relation between oop4-5.php and user_find.php / database tables

Posted by Panzerfaust 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Relation between oop4-5.php and user_find.php / database tables
October 18, 2012 10:42AM
Hi there

I’m a bit confused with oop4 and oop5.


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?


Many thanks
avatar
Mac
Re: Relation between oop4-5.php and user_find.php / database tables
October 18, 2012 11:57AM
Well, there you go smiling smiley 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.

It is thus all up to you how far you take it.
avatar Re: Relation between oop4-5.php and user_find.php / database tables
October 18, 2012 02:50PM
OIC

The statement "In your code text, remember to include BOTH the code of user_find.php and user.php" makes sense now.

Refering back to TL101 pg 10, all our code for a specific task should be on a single page, should have remembered that.

Many thanks
avatar
Mac
Re: Relation between oop4-5.php and user_find.php / database tables
October 18, 2012 03:04PM
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 sad smiley
Sorry, only registered users may post in this forum.

Click here to login