Programming - Good Practice - Names
Well, there I saw a comment on terms in English. The truth is that I also gives me much to put the terms in English. As for the language to use, both in the code, as in the models, it is my opinion that we should primarily consider the audience you are targeting. That is, if my development team is composed primarily of individuals who speak English we propose to use names or notations in English, as some may speak English but most speak English, understand?. The use English, is right when the customer is English speaking and our code is the property (outsourcing), or "stakeholders" (no direct translation into English, but it is something like the concerned people puts silver, etc) are English speaking.
En cuanto al código, algunas buenas practicas no dicen nada del lenguaje pero sugieren (En lo que recuerdo.no?) para:
- Constantes : nombres descriptivos, completamente escritos en mayúsculas remplazando los espacios es blanco con guiones bajos .
- Variables : nombres descriptivos de la misma. En java , se utiliza la notación " camelCase " donde se escribe todo junto y cada palabra comienza con una mayúscula menos la primera. Y no se suelen utilizar prefijos. En el caso de php se utiliza las notación que incluye guiones bajos (no recuerdo bien el nombre, is a little complicated). Var_name Ahem. Moreover, unlike Java, are commonly used prefixes. For example: obj_nombre_variable to refer to that variable is an object.
- Methods: similar to variables, but do not use prefixes for both php and java. its name is the verb + object structure . Example publicarNoticia (java) or publicar_noticia (php). With the exception of access methods to attributes or properties that whether or must have the structure getPropiedad (), setPropiedad (TipoPropiedad property), isPropiedad ().
- Classes: Names camelCase in singular and begin in uppercase, for Java and PHP5, C + +, etc.. Php4-In can be written in lowercase.
- Interfaces: the names must be written camelCase with the first word capitalized and be adjectives (PHP5, java). For example, publishable, votable, etc.
- Packages (php5, java). The names are lowercase words separated by periods. and its structure is as follows: dominio.alreves. [company / team / project]. nombrepaquete . For example if the site is for www.mipagina.com and work in the company could be com.mipagina.arosoft.utilidades
arosoft
Finally The names, depending on the layer architecture in which it is located, is another matter, to develop later. But it could anticipate that if a class that will be part of a service layer in a presenter of an MVP or something, ie an intermediate layer in coding could have the name of a gerund. For example: Publishing and every method that implements a use case have the same name as the tab for application written in CamelCase, to facilitate monitoring and functional testing of it.
Greetings, again I hope you wake up some ideas.
0 comments:
Post a Comment