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 66241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:04:20+00:00 2026-05-10T19:04:20+00:00

I am building a small website for fun/learning using a fairly standard Web/Service/Data Access

  • 0

I am building a small website for fun/learning using a fairly standard Web/Service/Data Access layered design.

To save me from constantly having to create instances of my service layer/data access layer classes, I have made the methods in them all static. I shouldn’t get concurrency issues as they use local variables etc and do not share any resources (things are simple enough for this at the moment).

As far as I can see the only trade-off for this is that I am not really following a true OO approach, but then again it keeps the code much cleaner.

Is there any reason this would not be a viable approach? What sort of problems might arise later on? Would it be better to have a ‘factory’ class that can return me instances of the service and data layer classes as needed?

  • 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. 2026-05-10T19:04:21+00:00Added an answer on May 10, 2026 at 7:04 pm

    Disadvantages:

    • You will be unable to write unit tests as you will be unable to write mock data access/business logic objects to test against.
    • You will have concurrency problems as different threads try to access the static code at the same time – or if you use synchronized static methods you will end up with threads queuing up to use the static methods.
    • You will not be able to use instance variables, which will become a restriction as the code becomes more complex.
    • It will be more difficult to replace elements of the business or data access layers if you need to.
    • If you intend to write your application in this manner you would be better off using a language designed to work in this way, such as PHP.

    You would be better off going for non-static business/data access layer classes by either:

    • Using the singleton pattern (creating a single instance of each class and sharing them among threads)…
    • Or creating instances of the classes in each thread as and when they are needed.

    Keep in mind that each user/session connected to your application will be running in it’s own thread – so your web application is inherently multi-threaded.

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

Sidebar

Ask A Question

Stats

  • Questions 111k
  • Answers 111k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the set as you proposed, that's exactly the right… May 11, 2026 at 9:41 pm
  • Editorial Team
    Editorial Team added an answer if you can use javascript: <input onfocus="this.blur()" type="radio" id="btn" name="btn"… May 11, 2026 at 9:41 pm
  • Editorial Team
    Editorial Team added an answer The rule is that when you clear a vector of… May 11, 2026 at 9:40 pm

Related Questions

I am starting a little side project which consists of building a small-medium sized,
I am considering creating my own website using Java and am trying to decide
I am writing a website in my spare time for an educational facility and
I am currently building a small website where the content of the main div

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.