Composite Design Pattern

It is a collection of objects, anyone of which can be either a composite or just a primitive object. It enables us to represent a single object or a collection of objects using the same interface.

Example

  • If we are designing a runtime system structure for java program, we can implement it in a tree form where every node can be a executable piece of statement and it may have other nodes in it (which should be executed before it) or may be a leaf node, which just need to execute itself and return the result to the parent (or makes the changes in shared state cache).
  • If we are designing a system to display the employee structuring of an organization. It could be in tree form or in any other form. But designing the data structure using composite pattern can easily manage the requirements for hierarchy structure, where any employee work as individual or may have a number of other employees as sub-ordinates. 

Bridge Design Pattern

It is used to separate the interface from its implementation and enables us to change either interface or implementation easily. Generally it is used to keep the client interface constant and even if we change the implementation.

It seems quite similar to adapter pattern, where we can adapt the functionalities of any other class and expose this with a separate interface. But the difference is in purpose, Adapter is implemented to use the existing implementation with a new interface but Bridge is used to separate the implementation from interface to user so that user won’t be affected by any change in implementation.

Example

  • We want to present some data to user. Based on the user profile, the data can be either in simple list form having names only or in a table having complete details. Here we can implement the logic to fetch the data and arranging it in required format in a separate class which can be accessed from user interface which could be a list, table or tree. 

Proxy Design Pattern

It enables us to avoid the creation of resource consuming object until its actual need in the system. A complex and heavy object can be represented by a simple proxy object which creates the illusion of actual object till the actual requirement of that object. The proxy object initializes the actual object whenever it gets the first request from client. So it delays the initialization of heavy states until these are actually required.

Example

  • In ORM tools, collections having a large number of items used to be initialized lazily using proxy pattern. Before actual initialization, only a proxy object creates the illusion of actual object.

Flyweight Design Pattern

Flyweight Pattern

Sometimes in system, a number of instances are required to represent the data even when all the instances are similar in structure and basic composition but with a few different parameters. Here using flyweight pattern, one instance can be used to represent the data by identifying the variable data and make the object configurable for this before every method call.

Example

  • In JTable, a column renderer serve the purpose to paint every cell on the table only table configures this renderer for its position, data and other variable attributes before using it for painting the next cell.
  • While painting a word on the screen, the same character instance is being used to paint complete word by just changing its location and data value.

Facade Design Pattern

Façade Pattern

It is used to hide the complexities of system behind a simple interface. Generally with time, the simple system grows to complex systems having a number of different APIs and objects to interact with. It happens especially if we are following the design patterns. Due to this increased complexities, it becomes very difficult for client to remember the exact flow of API and the right way to use it. Façade comes here and provides a simple interface to user, thus hides the complete complexity behind it. 

Example

  • One way to access database is to use the raw API of JDBC which may not be very convenient for every user or user may need to repeat same code again and again to access the database. Other alternative is to create a ‘Data Access Object’ which can hide the complexities of JDBC API and can provide a simple and convenient interfaced to user for most of the required operations. So we can define a SQL Data Access Manager which can provide methods like execute query, get table names etc. Here SQL Data Access Manager is working as façade.
  • Any session bean on server most of the time works as façade.
  • An Object Manager on server which allows the user to save any object and fire the relevant events in a single call.

What is the Use of Ant Build Tool

Ant is a build tool and is used in build process of softwares.

Now the question is that what is a build process? Build process is used to build the software, which comprises a list of tasks items  required to deploy the software application and make it runnable. A few task items are as:

  • Creating the basic structure for project, which is required for deployment. The structure may vary from project to project or depending upon the type of application
  • Taking the latest checkout of the project files from any source code version system
  • Copying the required set of files to the desired directories. This may include filtering of the files which are not required in deployment, but are required only for development. 
  • Compiling the source code to generate output runnable files
  • Copying the required non-source code files to output folders
  • Generating the documentation by using various tools like Java Doc or PHP Documenter. 
  • Running the test cases on the compiled source code
  • Package the output in required format, like jar, war, ear etc
  • Copy the packaged output to the target directory, like in application directory of web servers
  • Generate the schema in database
  • Run scripts for entering sample data in database
  • Starting/Restarting the server
  • And so on

How to file the Income Tax Return

Disclaimer: This information is only for knowledge purpose and may not be correct at all places. So after initial understanding from this article, it is good to refer to authenticated sources like Income Tax Department web site (http://www.incometaxindia.gov.in/) for various rules and procedures.

It is the time to file the income tax return again and we again need someone who can help us in filing the return. Here we are discussing that we can do it ourselves, if we have all the documents available with us for the income and deductions and if the sources of income are not very discrete and complex, like it can be in case of business income. Filing return is not that complex now. To file the return, we just need to understand the flow of filing the return. Once you understand it, it would be much simpler. So let us start to make some understanding of the process.

At first we need to remember the due date of filing the return. It is 31st July of every year. It is recommended that we should not wait till last week to file the return. There can be various unpredicted road blocks on the way, like you forgot to collect any document required for return, or the online sites are down due to heavy traffic and so on. So it is always good to be early.

Next is to collect all the information for your income and deductions. For income, you need to be aware about all heads of income which are defined by IT act. Here is the list of all income heads and the documents required for these

Wings of Fire - Agni ki Udan

'Agni ki Udan' is the autobiography of Dr. Avul Pakir Jainulabdeen Abdul Kalam. This is a wonderful book for the professionals who want to read some literature to have a direction in their profession, and in the life that how to utilize their knowledge and skills for social good and the country and for the Organization for which they are working. He is among one of few great scientist who have devoted their whole life for the progress of science and technology in country. Dr Kalam has shared their experience in this book which may not be able to describe his complete personality, however gives us a brief about him

  • As an innocent boy in the streets of 'Rameshwaram Ji', who has lived a simple life with his religious and simple family, 
  • As a student in college who came from a small town and left his home first time for studies; and then left an everlasting impression on many teachers with his sincerity, 
  • As an graduate engineer who had a dream job in mind however landed at some different job and still made a enourmous contribution everywhere with his passion, dedication and commitment to the work, 
  • As a true follower of Gurus like Dr Vikram Sarabhai, Dr Satish Dhawan, Dr Brahm Prakash, who has followed his seniors with utmost faith and respect and hence manage to change the future of country with their guidance and his efforts, 
  • As an amazing scientist who learnt from each experience and used all of his amazing intellectual power for his country without ever thinking for earning money outside the India, 
  • As a true and caring leader during PLSV and Indian Missile programme who has motivated a big big group of people across the institutions to work like a team with a single and defined mission in mind, 
  • And moreover as a good human being whose only mission was to do good for his country and even now is contributing to welfare of society in whatever mean he can do. 

How to Configure PHP Project in Eclipse for Debug Mode

Eclipse is very important tool for any developer, all due to the vast library of open source and freely available plug-ins which provides almost every required facility for development environment.

Now if we are using Eclipse, then ‘debug’ mode in Eclipse is a very useful tool to debug the code. Putting prints in the code and tracking the print-outs on the server console is very tedious job. So here we are explaining; how we can configure Eclipse and PHP web server to enable debugging of PHP applications in Eclipse using XDebug (http://www.xdebug.org/docs/).

As PHP code runs on web server, so that means, debugging can be performed only on server. So we put the debugging information in PHP code file using eclipse in IDE, however we need to install XDebug on web server for actual debugging. XDebug will sit on the server, and will generate the required debugging information like variable dump, stack traces etc and put all of this information for public use on a specific port of the server. Now any application can access this debug information by sending request to server on this port.

Eclipse works on same concept for showing debugging information for PHP application. It connects to the web server on given port, and fetches the debug information to show in a user friendly way with its UI. So to configure the debug mode in Eclipse, we need to configure XDebug on web server and also need to configure the eclipse for XDebug properties. Configuration steps are as following:

Data access by Client Pull or by Server Push

This is a design consideration between client - server interaction, i.e. whether client should call the server and pull the data from the server as and when required. Or the server should push the data to the client whenever there is some new data for the client.

Out of these two approaches, the first approach i.e. Client Pull is the most common approach where client opens a connection with the server (using any client/server protocol) and ask the server for the data. Here client pull the required data from the server as and when required.

Second approach is, where the server keep track of all its clients. Whenever server find any data which should be sent to the client, it pushes the data to the client. In this approach, there should be some provision using which server can interact to the client, like client should have some server socket open with it or client request should be hold on server for pending response for a long time. Now server keep track of all its clients. If we are working with server socket at the client, then it should be opened for all the time, so that server can connect to it anytime for pushing the data to client.

Sometime we find a need where server need to update the client for any latest data, like share trading software or weather information software. Here server keep getting updated data from multiple sources and now same data should be updated to all client terminals of the server. Now above mentioned both approaches can be used here as mentioned below: