Object-Oriented Data and Processes

• Identify a task you perform regularly, such as cooking, mowing the lawn, or driving a car.
• Write a short, structured design (pseudocode only) that accomplishes this task.
• Think about this task in an object-oriented way, and identify the objects involved in the task.
• Identify how you can encapsulate the data and processes you identified into an object-oriented design.
• Describe the architectural differences between the object-oriented and structured designs. Which of the designs makes more sense to you? Why?

I don't know how to write this, I tried and it is wrong, does it make sense to anyone?

Object oriented design made as much sense to me as did Ontology in Philosophy. Perhaps they are trying to examine the same thing.

See if this helps: http://en.wikipedia.org/wiki/Object-oriented_design

This is what I did and my instructor said its wrong. How do I fix it?


Driving a Car
Main Module
Class driving a car (door, seatBelt, mirrors, ignition, brake, gear, accelerator)
Sit in the driver seat
With car
End program
Sitting in the driver’s seat
Close the door
Put seat belt on
Check mirrors
Put key in the ignition
Put foot on brake pedal
Put in gear
Place foot on the accelerator
End Sitting in the driver’s seat program
With Car
Set close door = true
Set seatBelt on = true
Call mirror.adjust()
Call ignition.key()
Call brake.press()
Call gear.engage()
Call accelerator.place()
End With Car Program

Yes, I can help you with that. Let's start by breaking down the steps to answer each part of the question:

1. Identify a task you perform regularly:
Think of a task that you frequently do in your daily life, such as cooking, mowing the lawn, or driving a car.

2. Write a short, structured design (pseudocode only):
Create a step-by-step outline of how you typically accomplish the chosen task. Keep it simple and use pseudocode, which means writing the logic in a language-agnostic way.

3. Think about the task in an object-oriented way:
Identify the objects involved in the task. Objects can be physical or conceptual entities that have data and behavior associated with them.

4. Encapsulate the data and processes into an object-oriented design:
Consider how you can structure the data and define the methods (functions) for each object to perform the necessary actions associated with the task.

5. Describe the architectural differences between the object-oriented and structured designs:
Compare the object-oriented design, which focuses on organizing data and behavior into objects and their interactions, with the structured design, which typically uses a step-by-step procedural approach.

Now, let's go through each step in detail:

1. Identify a task you perform regularly:
Think about a task that you do frequently and feel comfortable explaining. This could be cooking a simple dish, mowing the lawn, or driving a car. Choose one and move on to the next step.

2. Write a short, structured design (pseudocode only):
Think about how you would accomplish the chosen task. Break it down into simple steps and write them in pseudocode. For example, if you chose "cooking a simple dish," your pseudocode might look like this:

```
1. Get the ingredients ready
2. Preheat the oven
3. Mix the ingredients together
4. Pour the mixture into a baking dish
5. Put the baking dish into the oven
6. Set a timer for the recommended baking time
7. Wait for the timer to go off
8. Take the dish out of the oven
9. Let it cool down
10. Serve and enjoy!
```

3. Think about the task in an object-oriented way:
Identify the objects involved in the task. In the case of cooking, the objects might be ingredients, cookware, and appliances.

4. Encapsulate the data and processes into an object-oriented design:
For each object identified in the previous step, consider their data and behavior. For example, an ingredient object could have properties like name, quantity, and measurement unit, as well as methods like measuring and adding to a recipe. Apply similar thinking to other objects.

5. Describe the architectural differences between the object-oriented and structured designs:
In a structured design, the steps are followed one after another, typically with variables and functions organized to perform specific actions. In contrast, an object-oriented design organizes data and behavior into objects, which interact with each other to accomplish the task. The focus is on encapsulating data and behavior within objects rather than following a strict sequential order.

In terms of which design makes more sense, it depends on the complexity and nature of the task. Object-oriented designs are particularly useful when dealing with more complex systems that involve multiple interacting objects. They provide a more modular and maintainable structure, allowing for easier extension and modification. Structured designs, on the other hand, can be simpler to implement for straightforward tasks, but they may become cumbersome as the complexity increases.

I hope this explanation helps you better understand the process of approaching the given task. If you have any further questions, feel free to ask!