Wednesday, November 17, 2021

Interview questions

 


1. Diff between abstract and interface

2. When/how we use interfaces with Sitecore development

3. Dependency injection in general and with Sitecore


    https://en.wikipedia.org/wiki/Dependency_injection#:~:text=Advantages%20and%20disadvantages-,Advantages,more%20reusable%2C%20testable%20and%20maintainable.


Dependency injection solves the following problems:[6]

  • How can a class be independent of how the objects on which it depends are created?
  • How can the way objects are created be specified in separate configuration files?
  • How can an application support different configurations?

Creating objects directly within the class commits the class to particular implementations. This makes it difficult to change the instantiation at runtime, especially in compiled languages where changing the underlying objects can require re-compiling the source code.

Dependency injection separates the creation of a client's dependencies from the client's behavior, which promotes loosely coupled programs[7] and the dependency inversion and single responsibility principles.[3][8] Fundamentally, dependency injection is based on passing parameters to a method.[9]

Dependency injection is an example of the more general concept of inversion of control.

An example of inversion of control without dependency injection is the template method pattern, where polymorphism is achieved through subclassing.[10] Dependency injection implements inversion of control through composition, and is often similar to the strategy pattern. While the strategy pattern is intended for dependencies that are interchangeable throughout an object's lifetime, in dependency injection it may be that only a single instance of a dependency is used.[11] This still achieves polymorphism, but through delegation and composition.

Dependency injection directly contrasts with the service locator pattern, which allows clients to know about the system they use to find dependencies.




4. Controller pattern: repository vs controller (dependency injection)

5. Diff between sitecore API's and Content Search API's. Fast query. 

6. Caching (types and when cleared). Rendering cache options. 





No comments:

Post a Comment