What is dependency Injection?
The ability to provide a component with its dependence either via construction injection, method calls or the setting of properties. …
What is a namespace, and how would you use it?
Namespaces are generally used to “group” sections of code with other related pieces of code, and can assist with code reusability. Namespaces prevent collision between different packages that have classes of the same name …
What is type declaration (also known as type hinting)
Good responses = A way to require parameters of functions to be of a certain type when called. (Bonus points if strict typing is mentioned) Type declaration ensures that parameters are always of the expected type. This reduces validation requirements for the developer. …
What are the 3 scopes that a class property or method can be declare as? What is the difference?
Responses = Private – the property/method can only be used by the class that defined it Protected – the property/method can only be used by the class that defined it and any sub-classes Public – the property/method can be called by any class …
What is class abstraction?
Good response = An abstract class is a class that cannot be instantiated and contains abstract methods that are used to define method signature rather than the implementation of the method. Any inheritance of the abstract class must implement any defined abstract methods, and cannot change the original signature. It is generally used to allow for similar usage across different implementation of code. …
Explain what what is a Trait?
Good response = A Trait is a reusable class that can provide fine-grained (small) sections functionality …