The following are few questions that deals with object orientation of Java, design patterns both software and hardware architectures and software engineering practices

  1.  What is the difference between layers and tiers ?
    A layer is more logical in nature,or how your code is logically divided to make each layer responsible for certain aspect of the application. While tier represents the physical separation of the system, meaning to say how yoursystem infrastructure or how the system is separated, client server, it is more of on hardware level. Typical example of layers are presentation layer,business layer , persistence layer and tiers are like client ( presentation tier, which the user can see and interact with like browser ) , persistence tier represents the server in which the database is situated etc. With the differences in place there are many architects and developers use these two terms interchangeably.
  2.  What is the difference between SPI and API ?
    SPI means Service provider Interface.It is a set of rules in form of code which one must extend or implement to provide set of functionality to the developer. Where as API is application Programming interface, is a set of coding units which one must call to achieve the functionality. For example Servlet API which is actually set of classes and specification which a container provider must implement, so it is an SPI, but when the implementation is ready by the container provider we use this set to achieve our web requirement. In such case it acts as both SPI and API ,and the difference is only the perspective.
     
  3. What is the point of setters/getters if they give access to the private fields , is not that almost same of not having these accessor / mutators and access the fields directly with public fields ?
    It at first may look like having direct access to the fields are better way , having no overhead of a pair of getter and setter. But the encapsulation also suggest the integrity of the data in the class. The integrity of the data in the class could never be maintained properly if it is just public fields and exposed without a check. For example the age of an employee can't be more than 50. Had we have the age integer field marked public , it exposes itself to direct manipulation which would lead to inconsistance behavior in the class , imagine a developer setting the age to 200 , it is not excepted.With the setters and getters in place we can make the age field restricted and inturn maintain the integrity of the class or object.
  4. Provide an example how inheritance can break encapsulation ?
     
    In Many cases it is suggested and a prefered way of achieve reusabity is composition than inheritance,however it would be compltely wrong to say to avoid inheritance, it is basic or integral part of OOD and can't live without.But inheritance can break encapsulation only when misused.
  5. How could encapsulation is information hiding , given that the getters/setters of corresponding properties types are known ? For example public Integer getAge(){} do tell us that integer is used for age field , is it information hiding then ? 
    Infomation hiding doesn't always mean that it would expose the type, Information hiding can be like if an Object uses another Object ( has-a ) and the object is not been exposed through public ( getter/setter ) this information is still hidden. However we still can hide the type information, but it is very limited. For example instead of using ArrayList for the data type we can use List , thus getter/setter tells the type List , but not the implementation.
     
  6. Why the Object class is not abstract ?
    Not all class which is a super means abstract, If you have a look at the Object class , all of the method has a meaningful definition, while it might not be a rightful explanation. We still could have made the Object abstract with fully implemented methods,but having this class marked abstract would make it too rigid in places when you need a new Object(), cases like synchronization and locking.
  7. What is abstract data type in Java  ?
    Modern object-oriented languages, such as C++ and Java, support a form of abstract data types. When a class is used as a type, it is an abstract type that refers to a hidden representation. In this model an ADT is typically implemented as a class, and each instance of the ADT is an object of that class
  8. What is horizontal scaling ?
    Adding more components in each of the tiers ( physical organization of hardware) would increase the performance of a system, is called horizontal scaling. For example to handle or reduce the database load of a database server it is wise to introduce more database server in the persistance tier of the system , and whose load is divided equally by a load balancer.Similarly more application server can be introduced to lessen the load on the application servers.
  9. What is the difference between functional and non-functional requirement  ?
  10. What is the difference between flexibility and extensibility of a software system ?