|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
OO design
I'm a comparative newby to OOP and I'm looking for some input on how things should be structured, according to OOP theory and best practices, for a project I'm working on.
What I'm playing with is building an app that will handle resizing and posting pictures to my web site. I need to pass the app a list of files that I want to upload and have the app (for each image): 1- resize the image 2- upload the image over ftp connection 3- insert a record into my db I've put together a Photo class that takes a filename and does the resizing and db classes for connecting to, and disconnecting from, the servers. The questions I have are: 1- Should I have a Manager class that handles dealing with getting the filename list from the user and calling the other classes or is there a better way to do that? 2- Where should the uploading and db registration routines be housed? Should I pass the Photo class connection objects and call a register method in the photo class or should I pass the photo object to the db and ftp classes and have them handle the uploading and db registration? Thanks y'all Ursus |
|
#2
|
||||
|
||||
|
RE: OO design
OO isn't my strongest suit either - so take this with a grain of salt. (OT - PHP can have both Procedural and OO in the same script - so don't feel you have to do it one way or the other... You can do both.)
Hmm - maybe a Photo class that handles the resize and holds the various data, a transport class for the uploading/downloading of an object, a general DB connection class and maybe a DB Results class (You could always extend them for specific photo database functionality)... To me the Manager should be procedural but I don't see why you couldn't do it as a class.. I personally would have Manager pass around the various objects to the functional classes as needed. *shrug* - sounds very similar to yours. |
|
#3
|
|||
|
|||
|
RE: OO design
Thanks for the input, Lig. I'm actually coding it in Python but, like PHP, it allows mixing OO and procedural code. I mostly wanted to do it in OO for the learning experience.
|
|
#4
|
||||
|
||||
|
RE: OO design
Python - another lang to learn when I have the time...
|
|
#5
|
|||
|
|||
|
RE: OO design
Funny you should mention it. I'm talking with Matt to try to get him to set up a Python section here on Codewalkers. He seems hesitant at the moment. If you think it would be useful to you, how about posting in support of the idea? The existing thread is http://codewalkers.com/forum/index....3&realm=default
|
|
#6
|
||||
|
||||
|
RE: OO design
I personally tend to agree with Matt though. I go to Codewalkers for help with PHP and Perl Monks for Perl. I would naturally tend to go to another site for another lang. Generally speaking in my mind if you generalize your sites too much - you tend not to attract the advanced users - which are the ones you want (least in my mind). I personally don't mind adding a forum for all other langs - but I tend to beleive it would be of little help to the people asking questions.
Sorry - but that's my $0.02 |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > OO design |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|