Skip to main content

Standardization of Method Signature



Today i would like to convey some of standards which most of it companies follows. Method signature which is not suppose to get changed when ever each parameter of a method is removed or added. If so we have to change all the code which uses this method. So its better to pass HashMap instead of passing each and every parameter.

Example:

public void addUser(int empid,String passcode,String addressStandardization of Method Signature,int mobileNumber)

Consider addUser method is used to process user data. In future if we want to add some parameter to addUser method we need to change all the code which uses the method addUser
so it is better to send HashMap instead of sending all data seperately
HashMap hm = new HashMap();
hm.put("empid","id");
hm.put("passcode","***");
hm.put("address","____");
hm.put("mobileNumber","000000000");

public void addUser(HashMap data)
{
int id = Integer.parseInt(data.get("empid"));
}
Now if user want to add a new parameter he can easily add by 
hm.add("sex","M");
Now the  method signature remains same. It wont get changed each time when dev add or remove parameter. This is a good practice to code. If we go by this way then there is no need to change all the code which uses the method addUser. The method signature remains constant. 

Popular posts from this blog

CONVERTING TORRENT FILE TO ZIP FILE

HOW TO CONVERT TORRENT FILE TO ZIP FILE 1>>click the link below  http://www.zbigz.com   2>>upload your .torrent file  3>>wait until conversion, after conversion your  file can be downloadable in .zip format.

Responsive PanelGrid in JSF Primeface

Here, we are going to learn about responsive PanelGrid in JSF Primeface component. As we know primefaces providing lots of good stuffs for JSF. In Primeface, there is a component name Panel Grid which we are going to use for our convenience. In most of the cases, PanelGrid used for making our content in a proper way. If users opens our website which we have made in jsf using panelGrid component that not in responsive manner, that could be really ugly as for as user concern, So here we are going to break it just by using Layout attribute in the panel Grid component. for exaple, < h3 >Responsive</ h3 > < p:panelGrid columns = "3" layout = "grid" >                 < h:outputText value = "Content" />      < h:outputText value = "Content" />      < h:outputText value = "Content" />      < h:outputText value = "C...

List Of Some Good Proxy Sites

List Of Some Good Proxy Sites               Below is the list of some good proxy site  which you can use to surf  anonymously on the internet . Even you can use this proxy sites  to open block website  in school or offices. For example you can use facebook if it is block at your school or office. List Of Top Proxy Sites http://aniscartujo.com/webproxy http://www.badboysproxy.com http://www.surfscreened.com http://www.hagiomusic.info http://www.greenpips.info http://urlbrowse.com http://www.hideipaddress.net http://www.sneakfilter.com http://www.browsestealth.com http://www.sneak1.info http://proxiesrus.com http://www.surfindark.com http://www.navydog.com http://falsario.com http://www.proxypit.com http://www.proxypan.com http://myspacewebproxy.org/ http://www.allfreehere.info http://www.takefreely.info http://autobypass.com http://www.proxcity.info http://www.proxyzip.org http://www.cheekyproxy.com http://w...