UOP PRG215 Week 4 Discussion Latest
PRG215 Java Programming
Week 4 Discussion
Clarifying Classes and Objects
Ironically, the defining concept supposed to make object-oriented programming languages easier to code than procedural languages, the concept of defining a class that can be used to create multiple, similar objects, is often one of the toughest for procedural programmers to grasp.
Many analogies have been used to explain the class > object concept, including:
cookie cutter > cookies: one cookie cutter can make multiple cookies, each of which may vary slightly (frosting, sprinkles, etc.) just as programmers can vary each object they instantiate from a class.
common noun > proper noun: man is a common noun; like a class, it defines a set of assumptions (two arms, two legs, one head, etc.) but doesn't refer to any specific individual. Instances of that common noun, like objects, do refer to specific individuals: Steve Smith, Ralph Jones, and Dan White. It's the same with other common nouns, like river (Boise River, Allegheny River, Nile River), city (Seattle, Boston, Phoenix), and so on.
blueprint > finished building: a single set of blueprints (class) defines specifications for a house, but every actual house (object) built from that blueprint will vary slightly.
Discuss this concept by posting your answers to the following questions:
Do you feel you understand the concept of creating multiple instances (objects) from a single class? If not, explain your confusion. If so, help clarify the concept to your teammates.
How do you suppose viewing a system as a collection of objects that interact with each other might affect the way programmers analyze and design Java™ programs, as opposed to viewing a system as a series of sequential instructions, which is how procedural programmers analyzed and designed programmers before object-oriented
languages like Java came along?
Discussion Question: Collaborative Debugging
Discuss your work on this week's coding assignment by posting the following to the discussion:
A description of any problem(s) you ran into when you tried to code and test this week's program, accompanied by a screenshot of your buggy Java™ code along with a screenshot of your running program, if needed
The steps you took to fix those problems (if you were able to fix them). Are you eyeballing the code? Relying on the debugger? A combination?
Suggestions for helping a classmate fix his or her buggy Java™ code