My quesiton is to just: why people do this:
Interface:
public interface CarDAO {
void addCar(Car car);
List<Car> readAll();
void deleteCar(Long id);
}
than create a class that implements carDAO
public class CarDAOImpl implements CarDAO {
private SessionFactory sessionFactory;
private Session getCurrentSession(){
return sessionFactory.getCurrentSession();
}
public void addCar(Car car) {
all the code to add the car
}
public void deleteCar(Car car) {
all the code to delete the car
}
why not just create a carCRUDclass without the interface?