• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

What means "best practice"?

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,


I have always seen some methods are described as "best practice". I am wondering what means "best practice", an algorithm?


Thanks in advance,
George
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Best practice is simply a term for a standard way of doing things that many people find to be optimal for various reasons (good performance, good design, high maintainability, good readability, etc). There is no one best practice for any given design decision as varying situations and goals affect which is "best."

An example of a best practice is coding to interfaces (as parameters and local variables) rather than implementations. If your method requires an indexed Collection, declare that it takes a List rather than a LinkedList. Unless you have a specific reason for requiring a LinkedList instead of an ArrayList or MyCoolList, sticking to the List interface makes your code more flexible while still maintaining correctness.
 
George Lin
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David,


Originally posted by David Harkness:
Best practice is simply a term for a standard way of doing things that many people find to be optimal for various reasons (good performance, good design, high maintainability, good readability, etc). There is no one best practice for any given design decision as varying situations and goals affect which is "best."

An example of a best practice is coding to interfaces (as parameters and local variables) rather than implementations. If your method requires an indexed Collection, declare that it takes a List rather than a LinkedList. Unless you have a specific reason for requiring a LinkedList instead of an ArrayList or MyCoolList, sticking to the List interface makes your code more flexible while still maintaining correctness.



So, it is a general concept (means a good method) and not specific to any topic or any technologies. Am I correct?


regards,
George
[ February 22, 2005: Message edited by: George Lin ]
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by George Lin:
So, it is a general concept (means a good method) and not specific to any topic or any technologies.

Yup, that's correct.
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic