Bits N Tricks

Design Patterns

“Inversion of Control is a generic design principle of software architecture that assists in creating reusable, modular software frameworks that are easy to maintain.” It is a design principle in which the Flow of Control is “received” from the generic-written library or reusable code. To understand it better, in procedural/traditional languages, the business logic generally controls the flow of the application and “Calls” the generic or reusable code/functions. For example, In a simple Console application, my flow of control is controlled by my program’s instructions, that may include the calls to some general reusable functions. In Contrast, in IoC, Frameworks are the reusable code that “Calls” the business logic. print (“Please enter your name:”); scan (&name); print (“Please enter your…

What Is jQuery Mobile? jQuery mobile is an open-source multi platform UI framework to create mobile apps. jQuery mobile is a cross platform framework basically used for mobile apps development using HTML5, CSS3, jQuery and jQuery UI. This framework is not only easy to use it is very robust, maintainable, and well organized. jQuery Mobile is a framework used to create mobile applications. jQuery Mobile is compatible with all desktop browsers and looks same on all mobile devices (Android, iOS and Windows Phone etc). jQuery Mobile is based on HTML5 & CSS3 to make the structure of the page with small amounts of scripting. Purpose of jQuery Mobile? jQuery Mobile helps you to get quick and good results with less…

In this article I’ll try to explain about one of the most common patterns, named Iterator Pattern. I am sure that every one of us must have used this pattern in our everyday programming tasks, either knowingly or unknowingly. Once we are through this article, we’ll realize how many times in a day we use this pattern in doing our normal tasks. Let’s start by understanding the intent of the Iterator pattern. Consider the example of a TV. We have different channels on different frequencies. So, we have a collection of Channels that we want to traverse. So, this collection is our Aggregate object that we would like to iterate through.So, we need a way to iterate through each channel,…

Here, I’m going to share with you my understanding of the Composite Pattern. Composite Pattern is used to work with hierarchical structures where both the primitive and composite objects are treated alike. The easiest example to understand could be a Tree or Navigation Menu which we generally see in Windows Explorer on the left side. It looks something like this Root —–Folder1 ————-File11 ————-File12 —–Folder2 ————-File21 ————-Folder21 ———————–File211 ————-Folder22 ————-Folder23 ———————–File231 —–Folder3 Here, all the folders can be treated as composite objects which can themselves contain more folders and files. Files are the Primitive objects or leaves in the tree. Both the primitive and the composite object will have an operation. The composite object’s operation will call the operations on…