3 Apr 2016

Fundamentals in OOPS Concepts


Oops Concepts
Abstraction
   focusing on essential characteristics of an object not all.
Encapsulation
   which hides internal details of object.
Modularity
    dividing cohesive and loosely coupled
  
Hierarchy
    (is a)
   (part of) – Aggregation
                       Containment
Aggregation(diamond)
   Inner objects life-time is not controlled by outer object.
Containment
    Inner objects life-time is controlled by outer object.
Polymorphism ( can be Aggregation
    compile
    runtime
Namespace
    Logical naming and grouping

Inheritance:
    It is white-box reusability. Concrete class can easily override the logic in base class.

Composition:
  It is black-box resuse, when I am using the object, I get access its public property but not its private.

Design Patterns (Brief)

9Design Patterns

CREATIONAL ( Object Creation)
1. Factory Method
      creating an instance of several of derived classes.
2. Abstract Factory
     creating a family of classes.
3. Builder
     Builds the object in parts. (step by step)
4. Singleton
     Only one instance of an object to be created.
5. Prototype
       Fully initialized object need to be copied or cloned.

STRUCTURAL
   1. Adapter
           Eg: different classes having different interface, we need adapter to match the interface of classes
2. Bridge
       When product is sold , support team separating the developing team from customer.
3. Composite
     is mainly involved in tree of Simple and composite (complex) objects.
4. Decorator
       used to add responsibility to the object at runtime dynamically.
5. Proxy
      used when you want an object to represent another object.
6. FlyWeight
     used when a fine grained object to be used efficiently.
7. Facade
   single class is representing sub-system. Abstract the complex structure.
BEHAVIOURAL
     1. Chain of Responsibility
              while passing request to chain of objects.
    2.  Command
              encapsulate the request in object
   3. Interpreter
           includes the language element in the program
  4. Iterator
         used when to take out traversal item in the list.
5. Mediator
     When we want to simplify between two objects.
6. Memento
        when we want to capture and restore (Eg: Undo operation)
7. Visitor
       defines new operation to class without changing the class.
8. Template
     differ exact steps to sub class.
9. Strategy
    to encapsulate an algorithm in a class.
10. State
         to alter object behavior only when its state change.
11. Observer
            to notify the change to other objects, (publish and subscriber).

31 Mar 2016

What is Software Architecture?


* Architecture Is a Set of Software Structures
3 categories of architectural structures:

                                              Fig23
Technorati Tags:

1. Modules. ( Module structures are static structures)
modules
2. Component-and-Connector (components are runtime entity).
                                               cc
3. Allocation Structures  (mapping of Software structures to environments like organizational, developmental, installations and execution)

30 Mar 2016

REST architectural style describes six constraints applied to architecture

 

1. Uniform Interface

uniforminterface uniforminterface2
Individual resources are identified using URLS. The resources (database) are themselves different from the representation (XML, JSON, HTML) sent to the client. The client can manipulate the resource through the representations provided they have the permissions. Each message sent between the client and the server is self-descriptive and includes enough information to describe how it is to be processed. The hypermedia that is hyperlinks and hypertext act as the engine for state transfer.

2. Stateless Interactions

stateless
none of the clients context is to be stored on the server side between the request. All of the information necessary to service the request is contained in the URL, query parameters, body or headers.

3. Cacheable

restcache
Clients can cache the responses. The responses must define themselves as cacheable or not to
prevent the client from sending the inappropriate data in response to further requests.

4. Client-Server


The clients and the server are separated from each other thus the client is not concerned with the data storage thus the portability of the client code is improved while on the server side the server is not concerned with the client interference thus the server is simpler and easy to scale.

5. Layered System

layered
At any time client cannot tell if it is connected to the end server or to an intermediate. The  intermediate layer helps to enforce the security policies and improve the system scalability by enabling load-balancing

6. Code on Demand

restcodeondemand

Technorati Tags:

an optional constraint where the server temporarily extends the functionality of a client by the transfer of executable code.

Web API Best Practices

 

Considering Top 10 Status

200 – OK – Everything is working
201 – OK – New resource has been created
204 – OK – The resource was successfully deleted

304 – Not Modified – The client can use cached data

400 – Bad Request – The request was invalid or cannot be served. The exact error should be explained in the error payload. E.g. „The JSON is not valid“
401 – Unauthorized – The request requires an user authentication
403 – Forbidden – The server understood the request, but is refusing it or the access is not allowed.
404 – Not found – There is no resource behind the URI.
422 – Unprocessable Entity – Should be used if the server cannot process the entity, e.g. if an image cannot be formatted or mandatory fields are missing in the payload.

500 – Internal Server Error – API developers should avoid this error. If an error occurs in the global catch blog, the stracktrace should be logged and not returned as response.

Explain Elastic Block Storage? What type of performance can you expect? How do you back it up? How do you improve performance?

 How do you improve performance?
EBS is a virtualized SAN or storage area network.  That means it is RAID storage to start with so it’s redundant and fault tolerant.  If disks die in that RAID you don’t lose data.  Great!  It is also virtualized, so you can provision and allocate storage, and attach it to your server with various API calls.  No calling the storage expert and asking him or her to run specialized commands from the hardware vendor.



Performance on EBS can exhibit variability.  That is it can go above the SLA performance level, then drop below it.  The SLA provides you with an average disk I/O rate you can expect.  This can frustrate some folks especially performance experts who expect reliable and consistent disk throughput on a server.  Traditional physically hosted servers behave that way.  Virtual AWS instances do not.

Backup EBS volumes by using the snapshot facility via API call or via a GUI interface like elasticfox.

Improve performance by using Linux software raid and striping across four volumes.

What is S3? What is it used for? Should encryption be used?

S3 stands for Simple Storage Service.  You can think of it like ftp storage, where you can move files to and from there, but not mount it like a filesystem.  AWS automatically puts your snapshots there, as well as AMIs there.  Encryption should be considered for sensitive data, as S3 is a proprietary technology developed by Amazon themselves, and as yet unproven vis-a-vis a security standpoint.




More references on AWS S3 here