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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:36:44+00:00 2026-06-17T01:36:44+00:00

I am working on refactoring an existing application written in PowerBuilder and Java and

  • 0

I am working on refactoring an existing application written in PowerBuilder and Java and which runs on Sybase EA Server (Jaguar). I am building a small framework to wrap around Jaguar API functions that are available in EA Server. One of the classes is to get runtime statistics from EA Server using the Monitoring class.

Without going into too much detail, Monitoring is a class in EA Server API that provides Jaguar Runtime Monitoring statistics (actual classes are in C++; EA Server provides a wrapper for these in Java, so they can be accessed through CORBA).

Below is the simplified version of my class. (I made a superclass which I inherit from for getting stats for components, conn. caches, HTTP etc).

public class JagMonCompStats {
...
    public void dumpStats(String type, String entity) {

    private String type = "Component";
        private String entity = "web_business_rules";
        private String[] header = {"Active", "Pooled", "invoke"};
        // This has a lot more keys, simplified for this discussion
        private static short[] compKeys = {
            (short) (MONITOR_COMPONENT_ACTIVE.value),
            (short) (MONITOR_COMPONENT_POOLED.value),
            (short) (MONITOR_COMPONENT_INVOKE.value)
        };
        private double[] data = null;

    ...
        /* Call to Jaguar API */
        Monitoring jm = MonitoringHelper.narrow(session.create("Jaguar/Monitoring"));
        data = jm.monitor(type, entity, keys);

    ...

        printStats(entity, header, data);
        ...
    }

    protected void printStats(String entityName, String[] header, double[] data) {

    /* print the header and print data in a formatted way */

    }
}

The line data = jm.monitor is the call to Jaguar API. It takes the type of the entity, the name of the entity, and the keys of the stats we want. This method returns a double array. I go on to print the header and data in a formatted output.

The program works, but I would like to get experts’ opinion on OO design aspect. For one, I want to be able to customize printStats to be able to print in different formats (for e.g., full blown report or a one-liner). Apart from this, I am also thinking of showing the stats on a web page or PowerBuilder screen, in which case printStats may not even be relevant. How would you do this in a real OO way?

  • 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-06-17T01:36:45+00:00Added an answer on June 17, 2026 at 1:36 am

    Well, it’s quite simple. Don’t print stats from this class. Return them. And let the caller decide how the returned stats should be displayed.

    Now that you can get stats, you can create a OneLinerStatsPrinter, a DetailedStatsPrinter, an HtmlStatsFormatter, or whatever you want.

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

Sidebar

Related Questions

I'm working on refactoring a suite of old utilities and creating a new server
I'm working on refactoring an inherited Ember application, with quite a bit of non-mvc
I'm working under refactoring of database (SQL Server 2008) scheme and gather arguments to
I am working on a Java project in Eclipse. Sometimes when I do refactoring
I'm currently working with an existing application that defines a couple constants on the
I'm working on an Android application and am faced with a refactoring issue; most
Everything was working fine in my app. Then, I did a small refactoring and
I am working on an application which has quite a bit of field-validation in
I'm currently working on refactoring one application. It is an application for a leasing
I am working on a brownfield application and am currently refactoring part of it.

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.