Following two concept is explain everything the use of OOPs.
1. Duplicate code is a Bad.
2. Code will always be changed.
So, above statement proves, OOPs is provides code reusability which reduce the duplication of code because once you have duplicate code, you have make changes everywhere which leads to performance. Code can be changed anytime or requirement of application changed anytime so when you want to make changes in your application, OOPs makes it easier.
Features of OOPs.
There are three main features of OOPS.
1. Abstraction: Learn abstraction here(PHP 5 Abstract classes and Methods)
2. Polymorphism : is a feature that allows one interface to be used for a general class of actions. It’s an operation may exhibit different behavior in different instances.
3. Inheritance : The process by which one class acquires the properties and functionalities of another class. Inheritance provides the idea of reusability of code and each sub class defines only those features that are unique to it.
Advantages of OOP
Object-Oriented Programming has the following advantages:
OOP provides a clear modular structure for programs which makes it good for defining abstract datatypes where implementation details are hidden and the unit has a clearly defined interface.
OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.
Approach to Object Oriented Design:
1. Start with the simple object which can be abstracted into individual classes.
2. Identify all the classes in the requirement specification.
3. Identify the commonalities between all or small groups of classes. Do not force fit generalization where it doesn’t make sense.
4. Keep all the data members private or protected
5. Identify all the member variables and methods the class should have
6. Ensure that the class is fully independent of other classes and contains all the necessary attributes and methods.
7. The methods in the class should be abstract.
8. Don't use the procedural code into a class for the methods in the class.
9. Inherit and extend classes from the base classes when require.
10. Define the "Has-A" or "Uses-A" relationships among the classes
if you are following fully oops concept then it makes you complex code easier, more relieable, more maintainable, and generally better.
OOP insists that you think about what you expose to the outside world, it lets you change the implementation of an object without affecting any other code. (Encapsulation)
it allows you to have many different functions, all with the same name, all doing the same job, but on different data. (Polymorphism)
it lets you write generic code: which will work with a range of data, so you don't have to write basic stuff over, and over again. (Generics)
it lets you write a set of functions, then expand them in different direction without changing or copying them in any way. (Inheritance)
Brajesh KumarPosted Mar 2, 2017, 1:51 AM
Following two concept is explain everything the use of OOPs.
1. Duplicate code is a Bad.
2. Code will always be changed.
So, above statement proves, OOPs is provides code reusability which reduce the duplication of code because once you have duplicate code, you have make changes everywhere which leads to performance. Code can be changed anytime or requirement of application changed anytime so when you want to make changes in your application, OOPs makes it easier.
Features of OOPs.
There are three main features of OOPS.
1. Abstraction: Learn abstraction here(PHP 5 Abstract classes and Methods)
2. Polymorphism : is a feature that allows one interface to be used for a general class of actions. It’s an operation may exhibit different behavior in different instances.
3. Inheritance : The process by which one class acquires the properties and functionalities of another class. Inheritance provides the idea of reusability of code and each sub class defines only those features that are unique to it.
Advantages of OOP
Object-Oriented Programming has the following advantages:
Approach to Object Oriented Design:
1. Start with the simple object which can be abstracted into individual classes.
2. Identify all the classes in the requirement specification.
3. Identify the commonalities between all or small groups of classes. Do not force fit generalization where it doesn’t make sense.
4. Keep all the data members private or protected
5. Identify all the member variables and methods the class should have
6. Ensure that the class is fully independent of other classes and contains all the necessary attributes and methods.
7. The methods in the class should be abstract.
8. Don't use the procedural code into a class for the methods in the class.
9. Inherit and extend classes from the base classes when require.
10. Define the "Has-A" or "Uses-A" relationships among the classes
Image Source: Google.
Rafnas T PPosted Mar 2, 2017, 1:57 AM
Gnanavel SekarPosted Mar 2, 2017, 1:52 AM