You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Raja Nagendra Kumar <Na...@tejasoft.com> on 2007/10/14 13:43:00 UTC

changes to function signature..

While I was looking into JbiTask class, I see a method connect with no return
type..
i.e

org.apache.servicemix.jbi.management.task.JbiTask

    public void connect() throws IOException {

..

As per my views on right naming conventions, either this method should
return some connection object or call it as makeConnection() - if we
continue to have the return type to void.

We at TejaSoft push for having code which does not need explicit
documentation to understand and maintain. So just a thought we could share
such finding to opensource product community

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft





-- 
View this message in context: http://www.nabble.com/changes-to-function-signature..-tf4621415s12049.html#a13198295
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: changes to function signature..

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Hi,

True, I see similar names in JDK Socket library too. However if the function
is not returning any thing, we see this naming is quite confusing with void
return type. Take a similar example of HashMap where put and remove does
return the object beeing put and added. Few inconsistancies..

If the name was doConnect() or makeConnection() could convey that it need
not return any thing. However just by method name connect(), once could
easily expect it to return something.  My view here is coming by
understanding of connect() is closer to thinking it as getConnection()
method.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com

-- 
View this message in context: http://www.nabble.com/changes-to-function-signature..-tf4621415s12049.html#a13200476
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: changes to function signature..

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Hi,

True, I see similar names in JDK Socket library too. However if the function
is not returning any thing, we see this naming is quite confusing with void
return type. Take a similar example of HashMap where put and remove does
return the object beeing put and added. Not sure if this is some thing to
similar to what we are talking here.. but I would see that it is must for
method name as verb to return some thing.

If the name was doConnect() or makeConnection() could convey that it need
not return any thing. However just by method name connect(), once could
easily expect it to return something.  My view here is coming by
understanding of connect() is closer to thinking it as getConnection()
method.

I appricate your views on the same.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com

-- 
View this message in context: http://www.nabble.com/changes-to-function-signature..-tf4621415s12049.html#a13200476
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: changes to function signature..

Posted by Oleg Zhurakousky <ol...@gmail.com>.
Connect (as connect()) does not and should not return anything since Objects
that are participating is some type of over the network connectivity could
be in the connected or disconnected state (just like your TV. When you plug
it it you change the state of the TV from disconnected to connected. You
don't bring anything back. You simply closing the circuit. You don't fill
the bucket with electrons and bring it back to the TV).  There is a
difference between getting connection (as connection object) and connecting.
You can also look at java.net API especially Socket interface.

Oleg Zhurakousky

HBO, MTV CCCP, KGB, WTF

On 10/14/07, Raja Nagendra Kumar <Na...@tejasoft.com> wrote:
>
>
> While I was looking into JbiTask class, I see a method connect with no
> return
> type..
> i.e
>
> org.apache.servicemix.jbi.management.task.JbiTask
>
>     public void connect() throws IOException {
>
> ..
>
> As per my views on right naming conventions, either this method should
> return some connection object or call it as makeConnection() - if we
> continue to have the return type to void.
>
> We at TejaSoft push for having code which does not need explicit
> documentation to understand and maintain. So just a thought we could share
> such finding to opensource product community
>
> Regards,
> Raja Nagendra Kumar,
> C.T.O
> www.tejasoft
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/changes-to-function-signature..-tf4621415s12049.html#a13198295
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>
>