axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <>
Subject [jira] Commented: (AXIS2-4188) JMSSender not extendable
Date Tue, 23 Dec 2008 21:20:44 GMT


Andreas Veithen commented on AXIS2-4188:


I understand your point of view very well. However I cannot agree with it. The reason is that
from a developer's perspective, having a class with lots of protected methods makes it extremely
hazardous to modify the code because you never know if by changing (or removing) a protected
method you break existing code in other projects [BTW: in the current version of JMSSender,
the signature of createJMSMessage has already changed compared to the version you are referring
to]. Excessive usage of protected methods is therefore an impediment to innovation and quality
improvement. In my opinion (and I'm not alone) the best practice is to make methods private
or final unless they are specifically intended to be overridden.

I agree with David that if you have specific needs, we will be very happy either to integrate
new functionalities into the code base, to define extension points that you can use or to
refactor some private methods into public static methods in a utility class.

> JMSSender not extendable
> ------------------------
>                 Key: AXIS2-4188
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: transports
>    Affects Versions: 1.5, 1.4.1, 1.4
>         Environment: All
>            Reporter: Ben Reif
>   Original Estimate: 0.03h
>  Remaining Estimate: 0.03h
> We need to extend the org.apache.axis2.transport.jms.JMSSender class so that we can add
some custom properties to the JMS Message (most likely via the MessageContext. However, the
class is full of private methods which must be copied into a sub-class, and it also uses other
classes such as JMSOutTransportInfo that only have package protected constructors. 
> This class is clearly meant to be extended because you can redefine the implementation
class in the axis2.xml. But rather then just extending it and overridding a method, you have
to jump through hoops and copy a bunch of code to do so. 
> In my opinion this is one of the most frustrating things about using open source code.
Many Apache (and Sun projects as well) have a bad habit of coding everything private, package
protected, or sometimes even making things final! Most open source projects these days are
designed to be extended, but coding things in this way defeats that purpose.  
> Sorry for the long rant and rave, overall I think Axis2 is really great, but could you
keep this in mind moving forward :) , and at least maybe make these methods protected in the
next release:
> JMSSender - 
> private Message createJMSMessage(MessageContext msgContext, Session session)  throws
JMSException {
> }
> private void setProperty(Message message, MessageContext msgCtx, String key){
> }
> private String getProperty(MessageContext mc, String key) {
> }
> private static void handleException(String s) {
> }
> private static void handleException(String s, Exception e) {
> }

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message