What is the difference between an abstract method and a virtual method?

An abstract function cannot have functionality. You’re basically saying, any child class MUST give their own version of this method, however it’s too general to even try to implement in the parent class. A virtual function, is basically saying look, here’s the functionality that may or may not be good enough for the child class. … Read more

Prefer composition over inheritance?

Prefer composition over inheritance as it is more malleable / easy to modify later, but do not use a compose-always approach. With composition, it’s easy to change behavior on the fly with Dependency Injection / Setters. Inheritance is more rigid as most languages do not allow you to derive from more than one type. So … Read more

What is dependency injection?

The best definition I’ve found so far is one by James Shore: “Dependency Injection” is a 25-dollar term for a 5-cent concept. […] Dependency injection means giving an object its instance variables. […]. There is an article by Martin Fowler that may prove useful, too. Dependency injection is basically providing the objects that an object … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)