Author Topic: Guys, do you follow any standard naming convention when programming in JAVA?  (Read 88 times)

0 Members and 1 Guest are viewing this topic.

Offline CyborgRepublic

  • Full Member
  • *
  • Posts: 203
  • Karma: +0/-0
    • View Profile
Guys, do you follow any standard naming convention when programming in JAVA? What rules do you have in place in your company that follows a standard in naming convention? Meron ba kayo?

Techronnati | where technology never sleeps


Mountain View

Offline JusticeLeague

  • Sr. Member
  • *
  • Posts: 359
  • Karma: +1/-0
    • View Profile
sa company namin, meron . software house kasi kami e. kelangan talaga sya. minsan naauudit din pag walang standard naming convention.

Offline MoneyRepublic

  • Full Member
  • *
  • Posts: 166
  • Karma: +0/-0
    • View Profile
bakit kelangan pa ng naming convention sa pag proprogram? di ba pwede assign ka nlang ng kung maisip mo?

Offline TDelight

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
    • View Profile
@MoneyRepublic. need ang convention sa pagproprogram kasi:

-Around roughly 70%-80% na binabayad sa software ay napupunta sa maintenance
-Bihirang bihira na ang original na author ng isang sofware ay sya na din ang magme-maintain ng code na yun sa buong lifetime ng software na yun. Usually, napapasa-pasa sa iba't ibang programmers ang -pag maintain ng code. Tsaka sa internet din galing ang code.
-Nag-iimprove ang readability ng code kaya mas mabilis maintindihan ng mga susunod na programmers.

Offline MrSpecialist

  • Sr. Member
  • *
  • Posts: 345
  • Karma: +1/-0
  • I'm an expert!
    • View Profile
sa company  namin may standard kaming sinusunod:

Packages - lowercase lahat na usually ay nagsisimula sa isa sa mga top level domains: com, edu, gove, mil, net, org or kaya two-letter code ng isang bansa based sa ISO Standard 3166, 1981. Yung mga susunod ay internal standard na ng company.
-sa mga simpleng projects lang, pwede din kahit ano depende na sa programmer/designer. basta dapat all lower case pa din.

Example:

Code: [Select]
edu.up.linux.core
org.pinoyjavatutorial.main

Classes - haha :D dito ko guilty kasi minsan kahit ano na lang ang name ng class ko or kaya verb ang name na gamit ko. Anyway, ang dapat talaga ay noun. Mixed case ang gamit. Mixed case means yung first letter of each word ay upper case. Minsan tawag nila sa mixed case ay camel case. Kasi parang likod ng camel na may dalawang humps. Anyway, kung ano pa ang tawag dyan, ang mahala ang first letter ng word ay laging capital tapos walang space. Try to avoid acronyms and abbreviations. Unless na yung abbreviation ay mas gamitin kaysa sa meaning nya like URL, HTML, WWW.
Example:

Code: [Select]
class SchoolBus
class Pencil
class BufferedReader

Interface - Mixed case din sya. Kaya ang first letter ng word ay upper case. Para syang class pero wala na syang restriction na dapat ay noun.
Example:

Code: [Select]
interface RasterDelegate
Method - should be verbs na ang pagkakasulat ay kagaya ng sa class except yung first letter ay lower case then yung mga sumunod na first letter ng word upper case na.
Example:

Code: [Select]
doGet();
setName();
main();

Variables - same ng naming convention ng methods pero wala ng restriction na dapat eh verb. Nga pala, variables should not start with underscores (_) or dollar sign $ kahit na pinapayagan sya ng compiler. Confusing kasi tingnan. It should be short and meaningful. Avoid using one letter variables din (e.g. 'a', 'b'). Except kung temporary variables lang.
Example:

Code: [Select]
int screenWidth;
String name;
int i;

Constants - All upper case na yung space ay replaced by underscores (_).
Example:

Code: [Select]
final double PI = 3.1416;

static final int END_DATE = 25;

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
200 Views
Last post May 15, 2013, 11:37:41 AM
by spartacus258
0 Replies
88 Views
Last post October 25, 2008, 08:36:46 AM
by Corps
0 Replies
72 Views
Last post November 27, 2008, 03:33:24 PM
by Corps
0 Replies
96 Views
Last post January 06, 2009, 07:07:40 AM
by rpmolecule
8 Replies
142 Views
Last post August 23, 2017, 12:05:54 PM
by rpmolecule

Posting Disclaimer: Any individual may post a message in this forum and may do so anonymously. Therefore, the sole author is exclusively and entirely responsible for all opinions in that message. They do not represent the official opinions of Techronnati, its administrators or moderators or the Techronnati Management. Techronnati is merely acting as an impartial conduit for constitutionally protected free speech and is not responsible and will not be held liable for the content of such messages. All images and service logos are trademarks of their respective owners.