Programming Theory
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesProgramming Theory

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 21st, 2006, 08:15 PM
Ursus Ursus is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Maryland, USA
Posts: 398 Ursus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 20 m 8 sec
Reputation Power: 2
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

Reply With Quote
  #2  
Old March 22nd, 2006, 10:10 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,727 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 4 m 45 sec
Reputation Power: 6
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.

Reply With Quote
  #3  
Old March 23rd, 2006, 12:51 AM
Ursus Ursus is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Maryland, USA
Posts: 398 Ursus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 20 m 8 sec
Reputation Power: 2
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.

Reply With Quote
  #4  
Old March 23rd, 2006, 02:10 AM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,727 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 4 m 45 sec
Reputation Power: 6
RE: OO design

Python - another lang to learn when I have the time...

Reply With Quote
  #5  
Old March 23rd, 2006, 12:06 PM
Ursus Ursus is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Maryland, USA
Posts: 398 Ursus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 20 m 8 sec
Reputation Power: 2
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

Reply With Quote
  #6  
Old March 23rd, 2006, 09:33 PM
lig's Avatar
lig lig is offline
"Forum Nazi"
Codewalkers Demi-God (4500 - 4999 posts)
 
Join Date: Apr 2007
Location: Jacksonville, Fl
Posts: 4,727 lig User rank is Private First Class (20 - 50 Reputation Level)lig User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 1 h 4 m 45 sec
Reputation Power: 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

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesProgramming Theory > OO design


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway