Categories
discuss

What is the use of creating a constructor for an abstract class in Java?

I would like to know what purpose a constructor for an abstract class serves; as we do not instantiate abstract classes, why would we ever need such a constructor?

Answer

there will be times when you have some common initialization of instance variables that all the inheriting classes need to set up. You do instantiate an abstract class when you extend it and that concrete class has a constructor that will either supply the parameters to the constructor of the abstract class.

Categories
discuss

How to determine web application end of life? [closed]

This question could bring a lot of opinions to the table, but what I will like to get is a set of measures that will help me and my company determine the end of life of a product that we sell.

We sell a CMS system, with this system we create a few sub-products

  • Websites
  • Proposal Creator
  • Marketing Campaign Tracker

We are ready to start our road planning (for 2010 and 2011) and we are trying to figure when will be the end of the life of our application. Some of you might think that a very well architected application (I don’t think our application is well architected) does not need to have an end of life, but this app that we are using goes back at least 6-7 years and has almost no documentation (real life). At this moment only ONE person knows how to change core functionality (scary).

Please advice,

Geo


Thanks to All! I really appreciate your comments, opinions and thoughts on this topic.

I will address a few of the post back questions in the list below

  • There is one developer that is able to maintain the core functionality of our product. (only and only one)
  • There are two developers that are able to increase functionality to a certain point. Both developers are constrained by the limitations of the core product, and they both have to work within those limits.
  • A very important note. The product that we are considering to put to end-of-life is for the most part being built by a contractor. The contractor is the only developer able to maintain the core functionality. We only develop on top of the contractor framework.

I will keep adding answers while I read you all responses.

Answer

Since application is very well architected you may not want to retire it and loose all investment you have made to date.

Here are my suggestions:

  • Have a junior developer join this
    current developer.
  • Dump most of future updates on junior
    developer (with assistance from sr.
    developer)
  • Ask junior developer to do the
    documentation of his work
  • Ask Sr. developer to review
    documentation

Over period of time, you have another person who can support this application and it will be documented as well. Now you won’t need to kill your own very well architected application with your own hands.

.

Extending this solution with Jefferey suggestion below(“Sometimes rewriting is a good investment.”)

If you still want to drop current application and re-write it, you still need to document existing system and create requirements for new system based off it.

Using documentation of current and proposed system, you may want to see if you can incrementally module by module upgrade (re-write) components. This is possible if application is very well architected.


As per your (Geo) comments

Geo’s organization has custom third-party (with one and only one contract developer) CMS application that implements below business requirements and is paying licensing fee for support and use of his code.

  • Business requirements for CMS
  • Websites
  • Proposal Creator
  • Marketing Campaign Tracker

Here are my suggestions

  • Create module by module detailed use
    case document for this project. Your
    developer can do this or would be
    ideal to have a seperate business
    analyst for same.
  • Hire a Sr. Developer to evaluate if
    open source CMS can handle all or
    most of your requirements (e.g.
    Joomla, Drupal, etc.).
  • Most important thing here would be
    ability to migrate your existing data
    to new system. You may need help from
    your existing contract developer to
    do this.
  • You may have to update business
    process or workflow to use new
    system.
  • Modules that cannot be implemented
    using open source CMS may be required
    to be implemented using custom
    website.

Much of it also depends on your business relation with existing contract developer and license agreement. What you are facing is a vendor lock in scenario. You may want to further research on solutions to eliminate this vendor lock in situation.

Categories
discuss

Title Attribute on Disabled Elements in Firefox

I am building a very dynamic web-based application using a lot of Javascript to handle user events. I am in the process of making things a little more usable and came across a problem that I’ve never had before.

I am using jQuery, so factor that in to your answers. Thanks in advance.

I have a set of button elements defined as:

<input type="button" title="My 'useful' text here." disabled="disabled" />

I have these buttons with a default style of:

div#option_buttons input {
     cursor: help;
}

Then, using jQuery I run something like this as a click-event on a select box:

window.current_column = '';
$('select.report_option_columns').live('click', function() {
    var column = $(this).val();
    if ( column == window.current_column ) {
        // clear our our previous selections
        window.current_column = '';
        // make this option no longer selected
        $(this).val('');

        $('div#option_buttons input').attr('disabled','disabled');
        $('div#option_buttons input').attr(
            'title',
            'You must select a column from this list.'
        );
        $('div#option_buttons input').css('cursor', 'help');
    } else {
        window.current_column = column;
        $('div#option_buttons input').attr('disabled','');
        $('div#option_buttons input').attr(
            'title',
            'Add this option for the column "' + column + '"'
        );
        $('div#option_buttons input').css('cursor', 'default');
    }
});

So, as you can see, when a column is selected in the select box (not shown here), I want the button to be enabled and behave like a button would (with my own click-events). But when a column is not selected (including the default load), I want the button disabled. The usability developer in me wanted to give the users subtle contextual clues as to what they can do to enable the button through the native rendering of the title attribute as a lightweight tooltip. I do this already in other areas of the application (this is a crazy beast of a project) and our usability tests have shown that the users are at least capable of recognizing that when the cursor changes to “help” that they can hover over the element and get some information about what is going on.

But this is the first time I’ve ever tried this with a form element. Apparently when I put disabled=”disabled” in the element, it completely ignores the title attribute and will never display the tool tip.

Now, I know I have a few options (at least the ones I could think of):

  1. Write my own custom tool tip plug-in that is a little bit more robust.
  2. Don’t “disable” the element, but style it as disabled. This was the option I was leaning on the most (in terms of ease to develop) but I hate having to do this.
  3. Leave the button as enabled but don’t process the click event. I don’t like this option as much because I like to leave things natively styled as they should logically be. A disabled button “feels” the most correct and the look of a disabled button is instantly recognizable as a disabled button.

So, with all that said, am I missing something? Is there something easy that I can do that I just haven’t thought of? Google searches have failed me on this topic, so I thought I’d toss this out on StackOverflow to get some fresh eyes on this.

**Edit**

I just found another StackOverflow question on this same topic, though that person used a very different set of terms describing his problem (probably why I didn’t find it).

The url to the question is: Firefox does not show tooltips on disabled input fields

Both of the answers on that question are pretty good, though I’d like to see if anyone has any other suggestions. Maybe something more jQuery specific? Thanks again.

Answer

There are several validation plugins that are very robust. You can find them in the jQuery plugins area.

Another option for you though which I happen to love and tends to be trending now adays is using the “Tipsy” plugin. You can put little ‘?’ icons to the right of your text fields and people can mouse over them to get a “facebook-like” tool tip. This plugin is very sharp and I highly recommend it.

Good luck!

Categories
discuss

why two date classes one in java.util.Date and java.sql.Date?

HI
I like to know why there are two Date classes in two different packages one in java.util.Date and one in java.sql.Date?
Whats the use of having two Date classes?

Answer

java.util.Date is Java’s Date data type.

java.sql.Date is a JDBC wrapper for SQL dates.

The two are represented completely differently internally.

.NET has the same concepts (but a better naming convention to differentiate the two in my opinion) with System.DataTime and System.Data.SqlTypes.SqlDateTime

Categories
discuss

Is Math.max(a,b) or (a>b)?a:b faster in Java?

Which one is faster in Java and why?

  1. Math.max(a,b)
  2. (a>b)?a:b

(This was asked in an interview.)

Answer

Math.max(a, b) is a static function (meaning no virtual call overhead) and will likely be inlined by the JVM to the same instructions as (a > b) ? a : b.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..