Skip to main content

Home/ SoftwareEngineering/ Group items tagged NamingConvention

Rss Feed Group items tagged

kuni katsuya

Polymorphism and Interfaces: Chapter 7 of Objects and Java - 0 views

  • Interface Naming Conventions
  • leave off redundant modifiers in member declarations of interfaces
  • either a noun or noun phrase
  • ...3 more annotations...
  • if you are using the interface to represent an abstract base class
  • adjective
  • if you are using the interface to represent a behavior
kuni katsuya

Java Interfaces/Implementation naming convention - Stack Overflow - 0 views

  • Putting I in front is just crappy hungarian style notation tautology that adds nothing but more stuff to type to your code.
  • An Interface in Java is a Type
  • And the Impl suffix is just more noise as well
  • ...5 more annotations...
  • Everything that implements Truck is a Type of Truck.
  • The name of the interface should describe the abstract concept the interface represents. Any implementation class should have some sort of specific traits that can be used to give it a more specific name.
  • no justification to have an interface at all.
  • If there is only one implementation class
  • Java Interfaces/Implementation naming convention
  •  
    "Putting I in front is just crappy hungarian style notation tautology that adds nothing but more stuff to type to your code"
kuni katsuya

Interface naming in Java - Stack Overflow - 0 views

  • interfaces define
  • capabilities
    • kuni katsuya
       
      this is one sensible interface naming option, if the interface encapsulates a cohesive set of behaviors and yes, compared to blindly following the meaningless I+ convention, it requires some thought, but thinking of an appropriate name also forces you to (re)consider the interface's primary responsibility and how it fits into the overall design imho, a class diagram for a domain model should be almost fluently readable english
  • not types
  • ...16 more annotations...
  • Comparable
  • Runnable
  • Serializable
  • Sometimes an Adjective doesn't make sense, but I'd still generally be using interfaces to model behavior, actions, capabilities, properties, etc,... not types.
  • Also, If you were really only going to make one User and call it User then what's the point of also having an IUser interface?
    • kuni katsuya
       
      another anti-pattern... blindly create an interface for every class, even if there's only one implementation!! arrgghhhh! consider introducing an interface when there are 2-3 well-distinguished, concrete implementations required
  • if you are going to have a few different types of users that need to implement a common interface, what does appending an "I" to the interface save you in choosing names of the implementations?
  • prefer not to use a prefix on interfaces:
  • hurts readability.
  • interfaces names should be as short and pleasant as possible
  • Implementing classes should be uglier to discourage their use.
    • kuni katsuya
       
      but they don't *have* to be ugly, like BlahImpl for specialized implementations, use descriptive adjective-noun combos
  • Code using an instance of some type should never, ever care if that type is an interface or a class
  • exposing such a detail in the name of the type is pointless and harmful to understanding
  • several reasons Java does not generally use the IUser convention.
  • should not have to know whether the client is using an interface or an implementation class
  • Java naming convention prefers longer names with actual meanings to Hungarian-style prefixes
  • Interface naming in Java [closed]
  •  
    "have interfaces define"
1 - 3 of 3
Showing 20 items per page