Thursday, April 13, 2006

 

The need for public method vs. published method

A public method is relying on a language syntax to make it public, usually a concrete class that contains public method will
mark its methods signature with a "public" keyword.

A published method is relying on a language interface to make it published. Usually a concrete class will implement some interfaces
that will contain methods, and in it is a contract that the particular class will abide.

The need for published method arise when different client will be exposed to different "public" method, ie. instead of exposing the
concrete class, we're only exposing certain methods to the client based on what the client "need" or allowed to access. When design
correctly published methods in interfaces can decouple client with concrete implementation of the class while supporting the Open Close
Principle.

For example, when using class to just expose its data for setter/getter to a client front end, to be mapped to user fields, the creator
of the class doesn't need to make other state changing methods that would otherwise be called by the layer where it isn't supposed to. Thus
exposing only the interface for getter/setter to the presentation layer, will prevent client on the layer to perform any business logic that
would have to be done in the other layer.

This idea was introduced by Robert Martin in his Seggregated Interface Pattern. The pattern was created to support the idea that different clients
will have their own need and concerns, thus they don't have to / shouldn't be exposed to just "one" interface, ie. the concrete implementation of
the class.

Comments:
While you read this, YOU start to BECOME aware of your surroundings, CERTIAN things that you were not aware of such as the temperature of the room, and sounds may make YOU realize you WANT a real college degree.

Call this number now, (413) 208-3069

Get an unexplained feeling of joy, Make it last longer by getting your COLLEGE DEGREE. Just as sure as the sun is coming up tomorrow, these College Degree's come complete with transcripts, and are VERIFIABLE.

You know THAT Corporate America takes advantage of loopholes in the system. ITS now YOUR turn to take advantage of this specific opportunity, Take a second, Get a BETTER FEELING of joy and a better future BY CALLING this number 24 hours a day.
(413) 208-3069
 
Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?