A pattern is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the natural process of pattern formation, elements of a pattern and general guidelines.
Prior to writing a design pattern, an individual should get familiar with existing patterns descriptions and grasp their underlying features. The structure and semantic of available patterns should be carefully understood, on the basis of its interaction and context, thereby deriving the principles that aid in assembling patterns for different arrangements. …
Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software.
It can also be considered as a specification or a template, for solving repeated problems, that can be implemented in multiple ways depending upon the situation.
These patterns are proven solutions to an issue, which assure optimal handling of the problem on hand and speed up the development process by overcoming current issues and minimizing future problems in software design.
Such patterns are robust and can be reused, which also acts as a communication medium…
Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods. Data refers to the values, variables or state that are used within the program and Method are the Procedures or Functions which manipulate that data.
In OOP, a computer program implements logic by making use of these objects that interact with each other. For this purpose multiple objects of similar or distinct structure are created within the program. Implementing similar objects again and again can consume time and creates redundancy in code. Class provides a solution…
In a computer program, control flow is the order in which set instructions are executed. A control flow statement changes program flow, to achieve specific results, by choosing a path from available paths. These statements can be based on some condition; executing instructions only when some condition is met; or can be unconditional; arbitrarily transferring the flow to some different instruction set. The goto statement was the most basic form of unconditional transfer. It transfers the control to the labelled instructions set.
Procedural Programming is an Imperative style of Programming Paradigm. It is a style of writing computer programs using procedures. Procedural Programming solves a problem by implementing and making use of various procedures.
Procedure is a sequence of computer instructions for performing a specific task. When we need to perform that same task again somewhere else then instead of writing the same instruction set again, we will call the procedure to perform the task. Procedure are also referred to as Routines, Subroutines and Functions. Procedures enable Modularity in a computer program. Procedure may have input arguments in order to perform given…
Functions in general, applies computation on given input and returns the output. It relates input to an output.
f(x) = x + 2;f(1) = 1 + 2 = 3;
f(2) = 2 + 2 = 4;
Above mentioned is a simple function that adds
2 to the input value and returns output. It relates value
[1,2] => [3,4]. Similarly, a function in computer programming is a block of instruction that performs computation on given input and returns the output.
Functional Programming is such a style of…
A program is a set of instructions that instruct the computer to perform a certain task. And Programming Paradigm are the styles of writing a computer program. Paradigms can be broadly classified into Imperative and Declarative programming based on how and what the computer is instructed to do.
Yes. An imperative program tells the computer about how to perform certain tasks. While a declarative program tells the computer about what to do and not really caring about how the computer does it.
Let’s imagine you are into shopping. You want to buy a T-Shirt. In your head you will have…
Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it. Hence a pattern can be termed as something, a philosophy, idea, theory or method through which we approach certain actions. The same is the case around with programming.
Programming Paradigms are the certain set of constructs and ideas through which we program a machine. It is a style of writing programs.
Imagine this, a friend of yours asks you for a favour. Since you…