Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:54:10+00:00 2026-05-22T11:54:10+00:00

I’m developing an application for transferring databases and directories of user-uploaded images/documents from our

  • 0

I’m developing an application for transferring databases and directories of user-uploaded images/documents from our production server to the development server. The application is written in Coldfusion, but I don’t think the language is relevant to this question – it’s more of a structural/architecture question than a question specific to the language.

I’ll be writing pseudo code for my examples, so please don’t pick apart the syntax.

When I’ve seen class inheritance demonstrated, it’s usually something simple like class Student extends Person() {}. Obviously, a Student is a more specialized Person, so this makes sense.

In my application, I have a class Site() which contains relevant information such as the DSN, file upload directory, etc. I perform my SQL exports in one class and my file upload exports in another class, both of which are called from within the site class(pseudo-code):

class Site {
    public function exportSql() {
        sqlExport = new sqlExport(this.dsn);
        sqlExport.createDumpAndZipItAndStuff();
    }
    public function exportUploads() {
        uploadsExport = new uploadsExport(this.uploadDirectory);
        uploadsExport.copyAndZipFilesAndStuff();
    }
}

The Site class doesn’t do anything other than control the flow of traffic that is requested from the front-end of the application, everything else is handed off to one of the export classes.

This works fine for me, but I’d like to structure it properly. Right now, I have to pass Site’s properties to the constructor of the export classes, and then set the export class’s properties with those arguments. This causes a lot of duplication.

Would it be appropriate to have my export classes inherit the Site class so that I could access the properties directly? The export classes are not a more specialized Site, as in the Person/Student example I gave earlier. Rather, they just perform the heavy lifting for the Site class.

If this is not an appropriate situation for inheritance, how should I structure the application? As I said earlier, the way I’m doing it right now works, but I would like to take this opportunity to learn more about design patterns and write my code in a way that makes sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:54:11+00:00Added an answer on May 22, 2026 at 11:54 am

    Inheritance should be use when something is a kind of another thing.

    Like a dog is kind of animal, therefor it should inherit from animal.

    Export is not a kind of Site, so it shouldn’t inherit from it.

    What you’re looking for is Composition. Export should hold a reference to a Site which it exports. Then you can pass the Site object to it on contruction, and it can get the data from the site whenever you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.