Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You use the concepts of abstraction and encapsulation every day. You may call it

ID: 3858572 • Letter: Y

Question

You use the concepts of abstraction and encapsulation every day. You may call it “understanding the bigger picture” or “seeing the forest for the trees.” It helps you manage the complexity of your tasks without getting bogged down in the details. Think about the ways in which you apply abstraction to your tasks or decisions. Think about the ways you apply encapsulation to your tasks and organizing your work. In the context of computer programming, abstraction requires you to eliminate detail from an object to identify its defining characteristics—the things that make the object “tick.”

Give an example that describes how you have used abstraction as a strategy and how it was beneficial to you. Be as specific as possible about the strategy and why you feel it worked well. How was encapsulation applied in your strategy?

Next, describe a situation in which abstraction or encapsulation may not yield the best results. After all, boiling a group of things down to their defining, component attributes may overlook unique and special characteristics of that group’s members, and this could lead to a less-than-ideal process or decision. Once again, be specific about your method and the results.

Thank you

Explanation / Answer

how you have used abstraction as a strategy----

Abstraction in its main sense is a conceptual process by which general rules and concepts are derived from the usage and classification of specific examples, literal ("real" or "concrete") signifiers, first principles, or other methods. "An abstraction" is the product of this process—a concept that acts as a super-categorical noun for all subordinate concepts, and connects any related concepts as a group, field, or category.

Conceptual abstractions may be formed by filtering the information content of a concept or an observable phenomenon, selecting only the aspects which are relevant for a particular purpose. For example, abstracting a leather soccer ball to the more general idea of a ball selects only the information on general ball attributes and behavior, eliminating the other characteristics of that particular ball. In a type–token distinction, a type (e.g., a 'ball') is more abstract than its tokens (e.g., 'that leather soccer ball').

Abstraction uses a strategy of simplification, wherein formerly concrete details are left ambiguous, vague, or undefined; thus effective communication about things in the abstract requires an intuitive or common experience between the communicator and the communication recipient. This is true for all verbal/abstract communication.

Abstractions sometimes have ambiguous referents; for example, "happiness" (when used as an abstraction) can refer to as many things as there are people and events or states of being which make them happy. Likewise, "architecture" refers not only to the design of safe, functional buildings, but also to elements of creation and innovation which aim at elegant solutions to construction problems, to the use of space, and to the attempt to evoke an emotional response in the builders, owners, viewers and users of the building.

how it was beneficial to you---

.It's provides ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using this concept.

.It's makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.

.It's provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.

How was encapsulation applied in your strategy---

The key difference is to understand what is encapsulated. The OO principle, both patterns depend on, is Encapsulate what varies.

In case of strategy, what varies is algorithm. For example, one strategy object knows how to output to XML file, while the other outputs to, say, JSON. Different algorithms are kept (encapsulated) in different classes. It is as simple as that.

In case of command, what varies is the request itself. Request may come from File Menu > Delete or Right Click > Context Menu > Delete or Just Delete Button pressed. All three cases can generate 3 command objects of same type. These command objects only represent 3 requests for deletion; not deletion algorithm. Since requests are bunch of objects now, we could manage them easily. Suddenly it become trivial to provide functionality such as undo or redo.

It doesn't matter how command implements the requested logic. On calling execute(), it may implement an algorithm to trigger deletion or it can even delegate it to other objects, may even delegate to a strategy. It is only implementation detail of the command pattern. This is why it is named as command though it is not a polite way to request :--)

Contrast it with strategy; this pattern is only concerned with the actual logic that gets executed. If we do that, it helps to achieve different combinations of behaviors with minimal set of classes, thus preventing class explosion.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote