Can you please help me answer these questions What does object oriented programm
ID: 3868377 • Letter: C
Question
Can you please help me answer these questions
What does object oriented programming (OOP) language mean, as opposed to any other language? Why use it over another language? What are the benefits of using classes, objects, methods, properties, etc???
What is the difference between using procedures and functions in your programming? Cite an example of when you would use a procedure, and not a function. Then give an example where you would use a function, and not a procedure. Tell WHY. You do not need to provide hard code, but you do need to provide pseudo code to make your point.
What are arrays? What is their purpose (why use them)? How do you get to a piece of data in the middle of an array? What do you use? (it has a name) Examples always help! Can be pseudo code to make your point.
If you don't have an array, what code would you program to store and access the data?
Explanation / Answer
In a complex object, with many attributes, we don’t need to understand all of its internal functionalities. The objects’s behaviors is made simple for us through object-oriented logic. When we apply this to software building, and it allows developers to break down big, complicated projects into compartmentalized objects, program them to have attributes and behaviors, then essentially set them aside and focus on programming how the objects interact—a higher level of thinking that makes writing code less linear and more efficient.
Advantages:
1. Ease of software design
2.Productivity
3. Easy testing, debugging, and maintenance
4. It’s reusable (function and classes)
5. Less development time, and more accurate coding. (inheritance method)
6. Data is safe and secure, with less data corruption, (data hiding and data abstraction)
A function returns a value and a procedure just executes commands. A function is flexible and reuseable. Because the results of the funtion is based on the inputs. For example we need factorial of 5 (i.e. 120) for some computation. Now for a different task we need factorial of 1,2,3,4 and 5. In ths case if procedures were used, we had to code for all kinds of inputs. but with functions, we can pass values as parameter and get different results from a single function code.
As mention in java documentation an array is a container object that holds a fixed number of values of a single type. We use them to store several data of same type under the same identifier. We can use array index to update data in the middle of the array. e.g. in java array index starts from 0, which means 1st elemnt has index of 0. so if we want to update the at 3rd position we generally type
array[2] = newData;
If there was no array, we could have used a language that allows user/programer to use a part of the main memory just by letting in the offsets. Such are very common in assembly languages