Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Done
-
16.11.01
-
None
Description
We should favor the use of interfaces rather than class to refer to objects where ever possible. It is entirely appropriate to refer an object by a class rather than an interface if no appropriate interface exists. But wherever appropriate interface exists we should use them to refer to objects.
For example:
ArrayList<EntityCondition> itemsExprs = new ArrayList<EntityCondition>();
should be written as :
List<EntityCondition> itemsExprs = new ArrayList<EntityCondition>();
Writing this way will make code more flexible . If you want to switch implementations, all you have to do is change the class name in the constructor and all surrounding code will continue to work.
This is parent ticket, we will create logical tasks for each component and collection class to improve this code. There are very less such occurrences and most of the code is written following the best practice. But we could improve the code which has not followed this best practice.