OO programming suggests that you use the following principles during the design of a software. The following are not "Design Principles" but a repetition of a good OO design.
In general a general manipulation of an object's variables by other objects or classes is discouraged to ensure data encapsulation. A class should provide methods through which other objects could access variables. Java deletes objects which are not longer used (garbage collection).
Java support the abstraction of data definition and concrete usage of this definition.
The concept is divided from the concrete which means you first define a class containing the variables and the behavior (methods) and afterwards you create the real objects which then all behave like the class defined it.
A class is the definition of the behavior and data. A class can not be directly be used.
A object in an instance of this class and is the real object which can be worked with.
The ability of object variables to contain objects of different classes. If class X1 is a subclass of class X then a method which is defined with a parameter for an object X can also get called which an object X1.
If you define a supertype for a group of classes any subclass of that supertype can be substituted where the supertype is expected.
If you use an interface as a polymorphic type any object which implements this interface can be used as arguments.
Inheritance allows that classes can be based on each other. If a class A inherits another class B this is called "class A extends class B".
For example you can define a base class which provides certain logging functionality and this class is extended by another class which adds email notification to the functionality.
Delegation is then you hand over the responsibility for a particular task to anther class or method.
If you need to use functionality in another class but you do not want to change that functionality then use delegation instead of inheritance.
When you refer to a whole family of behavior then you use composition. Here you program against an interface and then any class which implements this interface can be used to be defined. In composition the composition class is still defined in the calling class.
When you use composition, the composing object owns the behaviors is uses and they stop existing as soon as the composing object does.
Aggregation allows you to use behavior from another class without limiting the lifetime of those behaviors.
Aggregation is when one class is used as part of another class but still exists outside of that class.
Programming by contract assumes both sides in a transaction understand what actions generate what behavior and will abide by that contact.
Methods usually return null or unchecked exceptions when errors occurs in programming by contract environment.
If you believe that a method should not get called in a certain way just throw an unchecked runtime exception. This can be really powerful. Instead of checking in your calling code for exceptions you just throw an exception in the called code. Therefore you can easier identify the place in the coding their an error occurs. This follows the "crash-early" principle, which tells that if an error occurs in your software you should crash immediately and not later in the program because then it is hard to find the error.
A system should have a high cohesion.
Cohesion is a measure of how strongly-related and focused the responsibilities of a single class are. In object-oriented programming, it is beneficial to assign responsibilities to classes in a way that keeps cohesion high.
Code readability and the likelihood of reuse is increased, while complexity is kept manageable, in a highly-cohesive system.
Therefore you should avoid classes which have several responsibilities, e.g. a Logger class should only be responsible for logging.
Software entities like classes, modules and functions should be open for extension but closed for modifications.
This principles encourages developers to write code that can be easily extended with only minimal or no changes to existing code.
An example for a good application of this principles would be that a certain class calls internally an abstract class to conducted a certain behavior. At runtime this class is provided with an concrete implementation of this abstract class. This allows the developer later to implement another concrete calls of this abstract class without changing the code of the class which uses this abstract class.
Another excellent example is the Eclipse Extension Point method. Eclipse Plugins or Eclipse based application can define extension points where other plugs-ins can later add functionality.
Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteData Science Training in Chennai
Data science training in bangalore
Data science online training
Data science training in pune
Data Science training in kalyan nagar
Data Science training in OMR
selenium training in chennai
Thank you for an additional great post. Exactly where else could anybody get that kind of facts in this kind of a ideal way of writing? I have a presentation next week, and I’m around the appear for this kind of data.
ReplyDeletepython training in rajajinagar
Python training in btm
Python training in usa
Really you have done great job,There are may person searching about that now they will find enough resources by your post
ReplyDeleteangularjs Training in chennai
angularjs-Training in pune
angularjs-Training in chennai
angularjs Training in chennai
angularjs-Training in tambaram
Hello! This is my first visit to your blog! We are a team of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done an outstanding job.
ReplyDeleteAWS Interview Questions And Answers
AWS Training in Bangalore | Amazon Web Services Training in Bangalore
Amazon Web Services Training in Pune | Best AWS Training in Pune
Superb information, as always. After reading this one I really got refreshing and fantastic feeling! This is also a great and encouraging post.
ReplyDeleteSelenium Training in Chennai
Best selenium training in chennai
iOS Training in Chennai
.Net coaching centre in chennai
French Classes in Chennai
Big Data Training in Chennai
web development courses
web design training course
website designing training
Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!
ReplyDeletedevops online training
aws online training
data science with python online training
data science online training
rpa online training
Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks
ReplyDeleteMicrosoft Azure online training
Selenium online training
Java online training
Python online training
uipath online training
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
ReplyDeleteLinux Training in Chennai
Python Training in Chennai
Data Science Training in Chennai
RPA Training in Chennai
Devops Training in Chennai
When I initially commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now every time a comment is added I receive four emails with the exact same comment blog. Perhaps there is a means you are able to remove me from that service? Many thanks!
ReplyDeleteThanks for sharing such informative guide on .Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai and i use your guide to educate my students.
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Crystal clear explanation.Waiting for upcoming blog.
ReplyDeleteJava training in Chennai | Certification | Online Course Training | Java training in Bangalore | Certification | Online Course Training | Java training in Hyderabad | Certification | Online Course Training | Java training in Coimbatore | Certification | Online Course Training | Java training in Online | Certification | Online Course Training
Having read this I believed it was extremely informative. I appreciate you finding the time and energy to put this content together. I once again find myself personally spending a significant amount of time both reading and leaving comments. But so what, it was still worth it!
ReplyDeleteTechnology
Enroll yourself in an advanced career program of Python through AI Patasala Python Training in Hyderabad.
ReplyDeletePython Institute in Hyderabad
Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing.data science course in warangal
ReplyDeleteInteresting blog
ReplyDeleteDigital Marketing Institute in Mumbai
Thanks for sharing.
ReplyDeleteDigital Marketing Courses in Mumbai
This is an awesome motivating article. I am practically satisfied with your great work.You put truly extremely supportive data. Keep it up. Continue blogging. Hoping to perusing your next post
ReplyDeletedata science training in malaysia
betmatik
ReplyDeletekralbet
betpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
ODXO