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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:31:33+00:00 2026-05-14T00:31:33+00:00

I have a project (related to graph algorithms). It is written by someone else.

  • 0

I have a project (related to graph algorithms). It is written by someone else.

The code is horrible:

  • public fields, no getters/setters
  • huge methods, all public
  • some classes have over 20 fields
  • some classes have over 5 constructors (which are also huge)
  • some of those constructors just leave many fields null
    (so I can’t make some fields final, because then every second constructor signals errors)
  • methods and classes rely on each other in both directions

I have to rewrite this into a clean and understandable API.

Problem is: I myself don’t understand anything in this code.

Please give me hints on analyzing and understanding such code.

I was thinking, perhaps, there are tools which perform static code analysis
and give me call graphs and things like this.

  • 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-14T00:31:33+00:00Added an answer on May 14, 2026 at 12:31 am

    Oh dear 🙂 I envy you and not at the same time..ok let’s take one thing at a time. Some of these things you can tackle yourself before you set a code analyzing tool loose at it. This way you will gain a better understanding and be able to proceed much further than with a simple tool

    • public fields, no getters/setters
      • make everything private. Your rule should be to limit access as much as possible
    • huge methods, all public
      • split and make private where it makes sense to do so
    • some classes have over 20 fields
      • ugh..the Builder pattern in Effective Java 2nd Ed is a prime candidate for this.
    • some classes have over 5 constructors (which are also huge)
      • Sounds like telescoping constructors, same pattern as above will help
    • some of those constructors just left many fields null
      • yep it is telescoping constructors 🙂
    • methods and classes rely on each other in both directions
      • This will be the least fun. Try to remove inheritance unless you’re perfectly clear
        it is required and use composition instead via interfaces where applicable

    Best of luck we are here to help

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

Sidebar

Ask A Question

Stats

  • Questions 336k
  • Answers 336k
  • 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 EDIT: I was wrong about having to use an explicit… May 14, 2026 at 3:52 am
  • Editorial Team
    Editorial Team added an answer Look here for all string functions in PHP. http://php.net/manual/en/ref.strings.php use… May 14, 2026 at 3:52 am
  • Editorial Team
    Editorial Team added an answer You could replace the for-each with: <xsl:if test="State"> May 14, 2026 at 3:52 am

Related Questions

I have a SVN repository for my project; it keeps code, docs, graphs, etc.
I have a problem related to creating an instance of a WCF ServiceHost withing
I have a performance problem related to string comparison (in Java). I'm working on
I have a project that builds fine If I build it manually but it
I am creating a simple design for a social-networking site using the MVC paradigm(in

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.