Programming Homework helper
This report will discuss the difference between a procedural programming language and an object-oriented programming language. The writeup is based on the experience of the developer on writing a program using 2 different programming languages specifically C and Java.
The mentality of solving a problem differs between procedural and object-oriented paradigm. C is a procedural programming language where the developer has to break down the problem into modules (or also known as procedures). Each of these modules performs a specific task and then they work with other modules to meet a goal. On the other hand, the object-oriented paradigm is focused on what objects does the developer need to solve the problem.
When it comes to organizing the code both paradigm differs. In the procedural version of the solution, the modules are independent and we can call them when needed. We pass parameter values to these modules as an input and then it is up to the module to do its task and returns a result. The object-oriented version is different because we think of objects, their properties, and including methods of what they can do. The object-oriented paradigm encapsulates this information so it is easier for the developer to visualize the overall architecture of the program. The procedural approach's architecture can also be visualized through a block hierarchy diagram where we see a top-down chart diagram showing which module uses each module in the program. So we can see that the procedural approach has procedures distributed throughout while object-oriented has the objects distributed.
Knowing which is better is a personal opinion. Some people think more effectively using procedures and some are more effective solving programs using an object-oriented approach. In my personal opinion, solving the program using the procedural approach is easier because the focus is towards the functionality of the project and we simply put re-usable codes as a separate function for efficiency then we code as we go. Meanwhile, the object-oriented approach starts first by identifying the objects, thinking what should these objects hold, thinking about their functions. Once these objects are identified, we then think about how to solve the problem by making these objects work together. For someone more of a logical thinker, it will take them some time to get used to the object-oriented approach. We can see here that the object-oriented approach is more of an art because we are designing the elegance of the code. It takes a longer time to solve problems with object-oriented programming but it pays off when it comes to code maintenance and scaling. Object-oriented programming is easier to maintain because of how organized the code is made and they follow a principle (encapsulation, polymorphism, classes, inheritance, and so on). These principles are forced to be followed by developers when doing a project. Once these teams of developers follow a common principle, it makes it a breeze to work and scale on code. Many software frameworks nowadays are built using an object-oriented approach and many industries adopt it because of the features it provides.
Ironic as it seems but doing this simple project is supposedly be easier and faster to do using C language because of the procedural approach. However, it turned out that doing the project is easier in Java using the object-oriented paradigm. It is not that the procedural paradigm is the problem but rather it is because it is “C programming language” which lacks modules/procedures that would make the programming easier. The C programming language lacks data structures like lists and strings so everything is to be developed manually not to mention the fact that C developers have to also take care of using pointers, heaps, memory allocations, and other low-level programming stuff. Unlike Java which is a high-level programming language that is rich with libraries that we can directly use in the program. Through Java, input through the console, reading of the file, and parsing of data are more convenient. Java comes with these ready-made objects that we can use right away in the program without worrying about low-level implementations like pointers, heaps, and so on. However, if we use a different programming language like "Python" for procedural programming then the story would've turned out to be different.