How Do I Christen This Class?

How Do I Christen This Class?

Good design goes hand in hand with the nomenclature it uses for exchanging that design between developers. A key feature to writing good code consists of good naming conventions and consistency to ensure that the code will be reusable.

The purpose of any class that you design should be apparent from its name. In addition, it will help the reader if your class indicates whether it is an interface, an abstract class, or a concrete implementation class. You can christen the type of your class based on its “abstractness.” Let’s look at a simple inheritance example. Consider a class whose purpose is to manage something. We would definitely want to have the String “Manager” in its name. The definition of the hierarchy for this class consists of defining an interface, an abstract class that partially implements it (i.e., provides the implementation for some of its methods), and a concrete class that completes the implementation of the interface. The nomenclature should be as follows:

 public interface ManagerIfcpublic abstract class ManagerBase implements Managerpublic class ManagerImpl extends Manager

If other programmers look at this code and know your conventions, they can easily determine where in the hierarchy the class falls. An “Ifc” suffix indicates an interface; “Base” means an abstract class; “Impl” means an implementation. Only the class with the “Impl” suffix can be instantiated.

What if there are multiple implementations? In that case, the name should indicate what is the main characteristic of the implementation and the class “ManagerImpl” should just be a default implementation. For example, if we have “Product Managers” and “Project Managers,” we should name them as:

 public class ProductManagerImpl extends Managerpublic class ProjectManagerImpl extends Manager
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several