Postingan

Menampilkan postingan dengan label object oriented programming

Top 5 Object Oriented Programming and Design Courses in Java - Best of Lot

Gambar
There is no doubt that Object-oriented programming is a pillar of software development and also one of the reasons for the massive success of Java. Good knowledge of Object-oriented programming helps you to create better software. It also helps you to communicate your ideas better with your team members and fellow programmers. Despite being such an important technology, it's difficult to find programmers who understand OOP well. Many programmers just think that OOP is nothing more than Abstraction, Inheritance, Encapsulation, and Polymorphism, without truly understanding these concepts and mastering them. No doubt that they are the four pillars of Object-oriented programming, but OOP is much more than that. OOP is about thinking in terms of class and object, organizing your code following best practices like using SOLID design principles and design patterns to write code, which is easier to maintain and enhance. It eventually helps you to write better software, which is easier to c...

Top 5 books to Learn Object Oriented Programming - Must Read, Best of Lot

Gambar
The OOP or Object Oriented Programming is one of the most popular programming paradigms which helps you to organize code in the real-world system. It's a tool that allows you to write sophisticated software by thinking in terms of objects and relationships. Unlike its predecessor procedural Programming paradigm, which is implemented most notably by C, which solves the problem and complete task by writing code for computers, the OOP style of programming allows you to think in terms of real-world objects which have both state and behavior. You can view anything as objects and then find their state and behaviors, this will help you to simulate that object in code. Unfortunately, programmers don't learn OOP, or Procedural, or Functional programming, what they learn is a programming language, and as a side effect of that, they learn these paradigms. Since many developers learn Java, C++, or Python, they learn OOP, but not in the real sense, hence a college graduate struggle to apply...

What is Inheritance in Java and OOPS Tutorial - Example

Gambar
Inheritance in Java is an Object oriented orOOPS concepts, which allows to emulate real world Inheritance behavior, Inheritance allows code reuse in Object oriented programming language e.g. Java. Along with Abstraction, Polymorphism and Encapsulation, Inheritance forms basis of Object oriented programming. Inheritance is implemented using extends keyword in Java and When one Class extends another Class it inherit all non private members including fields and methods. Inheritance in Java can be best understand in terms of Parent and Child class, also known as Super class and Sub class in Java programming language. The class which extends another class becomes Child of the class it extends and inherits all its functionality which is not private or package-private given where Child class is created. Inheritance is the easiest way to reuse already written and tested code but not always the best way to do so, which we will see in this article. There are lot of example of Inheritance in Obje...

What is Class in Java Programming with General Example

Gambar
When I first about Class in Java I just thought what is this Class in Java and from that date to now Whenever we talk about java its really incomplete without classes, every one who are little bit familiar with java knows it’s purely object oriented language means every thing we discuss in java as object .so its very important for learner or anyone who is keen to know about java should know about java class then only they can move forward on java world. In this article we will see what Java Class, Example of Class in Java is and what makes a Java Class including members, field and method. If you have just started programming in Java or learning Please check my article How to Set Path for Java and How to set ClassPath for Java covering two important concept PATH and CLASSPATH. Class in Java Programming Example 1. What is a Java Class? Java class is nothing but a template for the object you are going to create or it’s a blueprint by using this we create an object. In simple word, we ca...

Decorator design Pattern in Java with Example Java Tutorial

Gambar
I was thinking to write on decorator design pattern in Java when I first wrote 10 interview questions on Singleton Pattern in Java. Since design pattern is quite important while building software and it’s equally important on any Core Java Interview, It’s always good to have clear understanding of various design patterns in Java. In this article we will explore and learn Decorator Design pattern in Java which is a prominent core Java design pattern and you can see lot of its example in JDK itself. JDK use decorator pattern in IO package where it has decorated Reader and Writer Classes for various scenario, for example BufferedReader and BufferedWriter are example of decorator design pattern in Java. From design perspective its also good idea to learn how existing things work inside JDK itself for example How HashMap works in Java or How SubString method work in Java, that will give you some idea of things you need to keep in mind while designing your Class or interface in Java. Now l...

Why Use Interface in Java or Object Oriented Programming

Gambar
Many times, I have seen questions like why should we use interface in Java , if we can not define any concrete methods inside interface? Or even more common, What is the real use of interface in Java? I can understand beginners asking this question, when they just see name of the method inside interface and nothing else. It takes time to realize real goodness or actual use of interface or abstraction in Java or any object oriented programming. One reason of this is lack of experience in really modelling something real in program using object oriented analysis and design. In this article, I will try to answer this question and give you couple of reason to use interface in your code. If you have good understanding of Object oriented basics e.g. Polymorphism, then you know that it allows you to write flexible code. Interface or abstraction are key to achieve polymorphism, when a caller use interface for calling a method, he introduce flexibility and dynamism in code, as that code will wor...

Difference between Inheritance and Polymorphism in Java and Object Oriented Programming

Gambar
Both Inheritance and Polymorphism are key OOP concepts and similar to Abstraction and Encapsulation, they are also closely related to each other. Because of their similarities, many OOP programmers, especially beginners get confused between Inheritance and Polymorphism. Even though they are closely related and you need Inheritance to support runtime Polymorphism they are a totally different concept. Inheritance refers to the ability for classes or objects to inherit properties of other classes or interfaces. It means you can write code for common functionalities and reuse it at different places by just using Inheritance and not re-writing those codes again and again. For example, you can write code to Inheritance vs Polymorphism in Java and Object-Oriented Programming Let's revisit some key differences between Inheritance and Polymorphism in object-oriented programming 1) Class vs Object Inheritance is used to define a class or interface hierarchy. You extract common functionality ...