SLR 3 - Programming Paradigms

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is Encapsulation?

"Wrapping up" the data of an object so that it is inaccessible outside the class, so that the attributes and behaviors of one object cant affect how another object functions. Attributes can be accessed using setters and getters.

What is Association?

A "has a" relationship i.e. a teacher has a student and a student has a teacher, there is no ownership.

What is a heirarchy chart?

A chart that breaks down a project into smaller chunks to help it to be visualised. Made using stepwise refinement.

What is the structured approach?

A logical approach that breaks down a large problem into easy-to-understand chunks. Uses modular programming and block structured languages such as python.

What is an assembly language?

A low-level language that uses mnemonics to represent different operations. Processor specific.

What is Polymorphism?

A programming language's ability to process objects differently depending on their class. e.g. the method "move()" in a cat class may move 5 spaces but 3 spaces in a rat class.

What is Composition?

A stronger form of association, where if the container class is destroyed, all instances of the contained class are also destroyed, for example if a hotel is destroyed, all the rooms of the hotel are also destroyed. Its icon is a filled in diamond.

What is a programming paradigm?

A style or way of programming, thinking about and approaching problems.

What is a Class?

A template for an object, which defines the attributes (private) and the methods/behaviours (public) of objects in that class.

What is Aggregation?

A type of association where one class is a CONTAINER of other class(es), however if one is destroyed the other continues to exist, e.g. if a football team disbands, the members of the team continue to exist. Its icon is a hollow diamond.

Why are multiple paradigms needed?

Although most languages are Turing Complete, i.e can solve all problems that a computer is able to solve, different paradigms are used as some are better suited to different situations.

What is an Object?

An instance of a class.

What is a procedural language?

Any high level language that allows for the use of procedures, functions, sequence, selection, iteration. Uses step by step instructions to solve problems. Data is held in variables or data structures. e.g. C, Python, Basic

What is top-down design?

Breaking down a problem into the major tasks to be performed, each of these is then broken down into seperate subtasks and so on until each subtask is simple enough to be written by a self-contained module.

What is Inheritance?

Classes can inherit methods and attributes from a parent class. (subclass and superclass)

What is a Constructor?

Code that instantiates an object.

Describe the design principle: Favour composition over inheritance.

Composition is preferable to inheritance, as it allows for greater flexibility and a less rigid relationship between objects. It should be used wherever possible.

What is Instantiation?

Creating a named instance of a class called an object. e.g. book1 = new Book(......)

What is Overriding?

Defining a method with the same name and formal argument types as a method inherited from a superclass.

Describe the design principle: program to interface, not implementation.

Focusing your design on what the code is doing and not how it does it.

What is an Object Oriented Language?

Uses objects modelled on the real world, objects interact with each-other. Uses encapsulation, inheritance, polymorphism. e.g. C++, Java.

What is Information Hiding?

Making attributes private in a class/object. so one class cannot access or change the attributes of another class, unless through the public methods. One class can use the methods of another class.

Describe the design principle: Encapsulate what varies.

Means when something varies in a program, it should be put into its own class. Therefore when a concept is encapsulated by a single module, only that module needs to change. To do this designers should take properties and methods and subdivide them into as many classes as are needed to make sure there is a true reflection of a real life scenario. Reduces maintenance and testing effort.

What is Object Oriented Programming?

Object-oriented programming is a programming paradigm based on the concept of "objects".

What are the three programming paradigms?

Procedural Object Oriented Assembly

What is stepwise refinement?

The process of breaking complex problems down into smaller, manageable steps.

What are access modifiers/specifiers?

Used in the concept of information hiding, to hide an objects instance variables. Private - only code within the class can access it Public - code within any class can access it Protected - code within a subclass or the same package/library can access it.

What are the advantages of stepwise refinement?

-All problems are found before the program is being made. -Most important parts of the program are established first. -The problem is broken down into smaller, more manageable problems.

What are the advantages of OOP?

-Forces designers to go through an extensive planning phase, which makes for better designs with fewer weaknesses. -Encapsulation: the source code for an object can be written, tested and maintained independently of the code for other objects. -Once an object is created, knowledge of how its methods are implemented is not necessary for a programmer to use it. -New objects can easily be created with small differences to existing ones. -Re-usability: objects that are already defined, coded and tested can be used in many different programs. OOP provides a good framework for code libraries. -Software maintenance: an OOP is easier to maintain than one written in a procedural language because of its rigidly enforced modular structure.

What are the advantages of the structured approach?

-Improves clarity and maintainability -Individual modules can be separately tested -Modules can be kept in a module library and reused -Modules are easier to debug, understand and maintain -Several programmers can work on separate modules, meaning it takes less time for a project to be completed.


Conjuntos de estudio relacionados

Topic 6: Rest, Sleep, Comfort, and Pain Management

View Set

Solving Equations with Variables on Both Sides

View Set

Nutrition Chapter 6: Lipids, Triglycerides, Phospholipids and steroids

View Set

BIOCHEMISTRY TOPIC 2: MUTATION AND REPAIR

View Set

DMLSS: Catalog Search and Record Management

View Set

FNAN 300 Exam 1 PRACTICE PROBLEMS

View Set

Kansas Life Insurance #4: Life Insurance Policies

View Set

Shape (left skew, right skew, symmetrical)

View Set

Interpreting and Statistically Evaluating a Correlation

View Set

Ch. 7 TB: Consumer Buying Behavior

View Set