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

  • SEARCH
  • Home
  • 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 6574177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:13:39+00:00 2026-05-25T15:13:39+00:00

I am a newbie in design patterns. I want to create an instance of

  • 0

I am a newbie in design patterns.
I want to create an instance of a class, say ClassA, and set some of its fields to the values read from a config file.
If I keep distinct the code of the class from the code that manages the file with the values then ClassA becomes a pure “businness logic” class.

 class ClassA {
    boolean config1;
    String originDB;
    String destDB;
    //other fields not initialized at the construction time
  }

  class ClassAFactory {
    boolean config1;
    String originDB;
    String destDB;        

    public ClassAFactory {
      //constructor of the class factory
      //load config values from file
    }

    public ClassA newInstance() {
     //create a new instance of ClassA and config fields config1, originDB, destDB
    }

  }

I would say that this is a builder pattern because builder seems to take care of “not only instantiation” but initialization too.
But otherwise, builder seems to be focused on breaking the creation process in steps, while in my case I have only one (yet compound) step.

May be considered a builder pattern? Or is it something different?

  • 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-25T15:13:40+00:00Added an answer on May 25, 2026 at 3:13 pm

    no steps – no Builder

        ClassA a = ClassABuilder
                .config(config1)
                .originDB(originDB)
                .destDB(destDB)
                .build();
        // above reads a Builder to me and hopefully to any reader
        //   note above allows to swap, add, remove particular steps
    
    
        ClassA a = ClassAFactory.newInstance();
        // above reads Factory to me and hopefully to any reader
        //   note for reader, it's a one-step thing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So this is a newbie rails design question. Lets say I want some of
i am a newbie to the design patterns and here is my question if
I am a newbie to Papervision. I want to design a sphere with 8
I am a newbie and trying to understand concepts of inheritance and design patterns.
I'm a newbie in visual basic dot net. I tried to create a design
I've heard and read many materials for design patterns, coding styles, programming techniques, etc...
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
DDD Newbie question: I read in a blog somewhere that in a scenario where
I'm attempting to design a SWT UI as a total newbie to both SWT
I am a newbie android developer and I am trying to design a simple

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.