Option D. Object Oriented Programming

studied byStudied by 11 people
0.0(0)
get a hint
hint

Object

1 / 77

Tags and Description

D.1, D.2, D.3, and D.4

78 Terms

1

Object

representation of a real world entity. describes that data that this entity has (properties/attributes) and actions that this entity can perform (methods)).

New cards
2

Unified Modeling Language (UML)

Provides a way to visualize the design of any software system and has evolved into the standard for modeling object-oriented programs. Modern extension of flow charts and can be though of as a superset of flowcharts.

New cards
3
<p>UML Class Diagram</p>

UML Class Diagram

Depict the classes within an object-oriented program as well as their collaborations. Classes within an object-orientated program are connected in various ways with each other and UML class diagrams represent those connections.

New cards
4

Association

how classes are connected. Represented by a line connecting the two classes. Each association has two roles and each role has a direction. Each association also has a multiplicities.

New cards
5

Multiplicities

Placed at each end of an association line and indicate the number of objects of one class linked to one object of the other class.

New cards
6

What does “1” as a Multiplicity mean?

Exactly One

New cards
7

What does “0..1” as a Multiplicity mean?

zero or one

New cards
8

What does “*” as a Multiplicity mean?

Many

New cards
9

What does “0..*” as a Multiplicity mean?

Zero or Many

New cards
10

What does “1..*” as a Multiplicity mean?

One or many

New cards
11

Inheritance

is a or is like relationship. In UML diagrams inheritance is displayed with hollow arrows.

New cards
12

Decomposition

breaking up the problem into several related objects.

New cards
13

What are the four relationships that can be described in a UML class diagram

  • Association

  • Dependency

  • Aggregation

  • Inheritance

New cards
14

Association

The simplest relationship that can be present between two or more objects. It is represented with a solid line. One or two roles labels may be present to signify the type of association that takes place.

New cards
15

Dependency (“uses” relationship)

one object is dependent on one or more objects in order to function. The implementation of an object depends on one or more other objects. Represented with a dashed arrow, that goes from the object to the object that the first one depends on.

New cards
16

Inheritance (“is a” relationship)

Signifies that one object is a specialized form of another object. Represented by a hollow triangle with a line. The triangle points to the parent

New cards
17

Aggregation (“has a” relationship

One object belongs to another object and none other. A special kind of association between two objects. The two objects are not dependent on one another. It is represented by a hollow diamond from the parent class then a line.

New cards
18

Dependencies

When one object uses another object, the first object depends on the second since it cannot function without it. Whenever the first object needs to be used, the second object will be used as well. Dependencies are directional.

New cards
19

What are Coupled Classes?

Two classes which use one another. The degrees of the relationship between Coupled Classes is continuous not discrete.

New cards
20

Why are dependencies are bad?

They decrease reuse. Reuse is found in code where parts are reiterated or have a replicated structure; helpful in code readability.

Changes in one class will affect other classes which may increase errors in code.

New cards
21

Data Types

Allow programs to classify these data into different types.

  • Integers

  • Real numbers (float and double)

  • Boolean

  • Strings

New cards
22

Parameter

the name of the information that is used in a method, function, or procedure

New cards
23

Argument

the value that is passed into a method, function, or procedure

New cards
24

Encapsulation

the inclusion of both data and actions into a single component. Classes contain data and actions that are built-in such a way so that their structure is hidden and can only be accessed outside the class via specific methods.

  • Plays the protective wall that prevents data and actions from being accessed from outside a class.

  • Creates a ‘black box’ for an object, separating its behavior and implementation by restricting access to data and actions as necessary

New cards
25

Polymorphism

the ability to have many forms

New cards
26

Static Polymorphism

Understanding the method signatures and decide the method that needs to be invoked for a particular method call depending on the number and types of parameters passed

New cards
27

Dynamic Polymorphism

A subclass overrides actions of the superclass. It allows for subclasses to alter any parent class actions and make them specific to their needs.

New cards
28

Advantages of Encapsulation

  • Data in a class can be made read or write only

  • A class restricts the ways that its data and actions can be altered or called

  • A class can hide the way that data is stored

  • Easier to maintain as changes to data and actions in a class can take place without being apparent on the outside, as long as data and actions can still be accessed through the same way

  • Increase in usability

New cards
29

Advantages of Inheritance

  • Extensibility: all child classes inherit the actions and data of a parent class. Furthermore, child class may add new functionality, extending the parent’s actions and data, or even redefining them

  • Reusability: child classes that inherit the actions and data of a parent class will not need to be altered in the event that an inherited action or data needs to be upgraded. When parent class actions are upgraded, all child classes that inherit from the parent class will automatically use the new upgraded version of these actions. This fact reduces maintenance overheads as an action needs only to be changed once and all the dependent child classes will use it

  • Information hiding: the parent class determines what actions and data are available to the child classes

  • Overriding of Actions: child classes may override parent actions in order to implement meaningful actions for their needs. AS such, for a child class, inheriting from a parent class means that it can use whichever data and actions needed, as well as implement or improve on any parent actions.

New cards
30

Advantages of Polymorphism

  • Object actions can have the same name but different parameter lists and processes

  • Subclasses can have their own unique actions, as well as being able to override or improve on parent actions

  • Subclasses inherit all parent data and actions, without rewriting code, and can alter the actions that they deem necessary. This allows for code reusability

  • Polymorphism provides a high degree of decoupling since to an external program the implementation behind actions is hidden. A common interface exists for a family of objects that abstracts and hides the details of the implementation.

New cards
31

Libraries of Objects

Collections of classes that have already been written in code and can be used by a programmer while developing a program. The availability of libraries as well as their use simplifies the work that has to be put into a project since standard, tested, working code is available for various functions.

New cards
32

Advantages of Libraries

  • Saves development time - classes and their methods do not need to be rewritten

  • Promotes abstraction - reusable code exists that functions without knowledge of internal working

  • libraries contain error-free/ robust code - because it has been used and tested many times;

  • promotes efficiency/organization - as code will be shorter/easier to read/ develop

  • familiarity with libraries - allow for easier maintenance/ modification

New cards
33

Disadvantages of Object Oriented Programming

Good for large-scale projects, but not for small projects with few developers and modules.

  • Size: much larger than other programs

  • Effort: requires a greater level of planning before any code is written

  • Speed: typically run slower due to their size.

New cards
34

Use of Programming Teams

Modular nature of OOP means that objects can be assigned to a different coder to program, as long as any shared methods are known.

New cards
35

Advantages of Programming Teams

  • Larger projects can be taken since more developers can work on them

  • Compared to a solo developer, members of a team may bring various ideas to the table that would not have come about without member collaboration

  • the strengths of some team members may offset the weaknesses of other members

  • team members do not know the workings of the whole project, and can thus concentrate their time and energy in developing part of a project to a higher standard

New cards
36

Disadvantages of Programming Teams

  • There needs to be honest, well-mannered communication between team members. There needs to be a common “language” to enable collaboration

  • Weakness of some team members may end up undermining the group as a whole

  • Since team members will not be aware of the project as a whole and because members will be working on different aspects, decisions, and project planning takes longer compared to a single developer project

New cards
37

Modularity

related to the process of dividing a computer program into separate smaller sub-programs that can be implemented and tested on their own before combining them all together to build the final program. Makes the program more effective when there are logic boundaries between the sub-programs and there are very few dependencies with each other.

New cards
38

Advantages of Modularity

  • Subprograms can be reused in other applications

  • Less new code needs to be written for a program

  • Team support.

  • The code of a program is comprised of a short, simple, and easy to understand smaller subprograms that are easier to maintain and debug

  • The structure of a program is easier to understand

  • Subprograms works as “black boxes” that can be changed or updated without other team members needing to be involved

  • Speedier completion of the subprograms and as a result the whole program itself, compared to taking on the program as one large problem

New cards
39

Class

Defines the fields and methods for a group of similar objects. An object is an instance of a class

New cards
40

Identifier

A broad terms for the name of a variable or method.

New cards
41

Primitive (Data Type)

int, long, double, char, Boolean, byte, etc.

New cards
42

instance variable

the fields in a class. When an object is created of that class type, it has its own version of the fields

New cards
43

Parameter Variable

Information sent into a method from the calling program.

example: public int add(int x, int y)

New cards
44

Local Variable

A variable which exists only as long as the code to which it belongs exists. So if declared in a method which is no longer being run; the variable no longer exists/it is overwritten

New cards
45

Method

a program routine or behavior contained within an object designed to preform a particular task on the fields within an object

New cards
46

Accessor

A method that allows access to the fields within an object

Example: getName()

New cards
47

Mutator

A method that looks the values of the files in an object to be changed

Example: setName()

New cards
48

Constructor

the method that correctly initializes and sets up an object when it is created. This method has the same name as the class it belongs to and has no return data type

example: public person()

New cards
49

Signature

the method name and its parameter types

example: doSomething(String y)

New cards
50

Return Value

The value returned by a method to the calling program

New cards
51

Private

Variables, methods, fields, and constructors that can only be accessed within the declared class itself. Classes cannot be private. An object is able to encapsulate itself and hide its data from outside access

New cards
52

Protected

Variables, methods, fields and constructors declared protected in the super-class can only be accessed by the sub-classes

New cards
53

Public

variables, methods, fields and constructors declared public can be access from any other classE

New cards
54

xtends

this is used by a sub-class to say that it inherits the fields and methods from a super-class

New cards
55

Static

A static is a member of a class which isn’t associated with the instance of a class. It belongs to the class itself. AS such, you can access the static member without first creating a class instance

New cards
56

8 primitive Data types

  • Byte

  • Short

  • Int

  • Long

  • Float

  • Double

  • Char

  • Boolean

  • String

New cards
57

Byte

  • Minimum value: -128

  • Max Value: 127

  • It occupies 8 bits of memory

  • Typically used for saving memory in large arrays of small numbers

New cards
58

Short

  • Minimum Value : -32,768

  • Maximum Value: 32767

  • It occupies 16 bits of memory

  • Typically used for the same reasons as a byte, but for a wider range of number

New cards
59

Int

  • min value: -2³1

  • Max: 2³1 - 1

  • It occupies 32 bits of memory

  • Most commonly used as primitive Data type to represent integer numbers

New cards
60

Long

  • Minimum value -2^63

  • max Value: 2^63 - 1

  • It occupies 64 bits of memory

  • Primitive Data type to represent integer numbers when the range of the int data type is not sufficient

New cards
61

Float

  • 1.4 ^-45 to 3.4³8

  • It occupies 32 bits of memory

  • Typically used for saving memory in large arrays of floating point numbers. Should not be used as a data type for numbers that need precision

New cards
62

Double

  • 4.9^-324 to 1.7³08

  • It occupies 64 bits of memory

  • Most commonly used data type for the representation of decimal values. Should not be used as a data type for precise values such as currency

New cards
63

Char

  • Minimum Value: ‘\u000’ - 0

  • max Value: ‘\ufff’ -65535

  • It occupies 16 bits of memory

  • represents a Unicode character

New cards
64

Boolean

  • Can take only take one of two values: true or false

  • Typically used for conditions that may have one of two outcomes

New cards
65

String

  • It is not a primitive Data type but rather a reference class

  • Typically used to represent series of characters

  • Once it is created its value cannot change and it is thus immutable

New cards
66

Common Character Sets

Used among many platforms and languages, like Unicode. Unlike ASCII, Unicode has a larger number of characters so has letters and symbols from different alphabets/languages

New cards
67

Platform independent Languages

High Level Programming languages like java enable code to run on many different plateforms

New cards
68

Ethical/Moral Obligations

  • Adequate Testing: to prevent possibilities of commercial or other damage

  • Plagiarism: Acknowledge the work of other programmer to avoid being accused of plagiarism

  • Open Source Movement: increasing support for open-source software where you are given access to the code for free, allowing you to make changes/customization to meet exact needs.

New cards
69

Advantages of Objects

  • Objects can be easily passed around the program, and so are modular in nature

  • Allows for re-use for objects already created

  • Debugging ease; if a bicycle is broke you replace the bolt, not the whole bike. Similarly, you can replace and diagnose specific objects

New cards
70

Members/Attributes/Features

Objects have their own variables, constants and methods associated to it. These are broadly known as ‘Members’ or ‘Features’ or “Attributes of an Object'“

New cards
71

Expressions

A construct made up of variables, Operators and method invocations which evaluate to a value. Expressions are the core components of statements; and these statements may be grouped into ‘statement blocks’

New cards
72

Statements

Statements are like sentences, it is a complete unit of execution; each line in a program is a statement. Methods are defined by the statements within them, since these create their behavior. Statements specify a sequence of actions which should be performed when the method is invoked

New cards
73

Statement Blocks

Any sequence of statements can be grouped together to function as a single statement when expressed within braces - {}.

A statement block can be written inside another statement, this is known as ‘nesting’ they are used to define methods.

New cards
74

Control Flow Statement

Statements are executed sequentially on their own. However, Java has control statements which break the sequential flow of code, and allow repetitive execution of statements and conditional execution of statements

New cards
75

Case-Switch-Break/default

A switch statement can have any number of possible execution paths for int, char and byte data types.

New cards
76

Break

Terminates a loop when a value is found or statement block completeE

New cards
77

Return

Exits from the current method and returns to where the method was originally invoked. By specifying a value with return, the exit can be achieved whilst sending the value back.

New cards
78

Benefit of Decomposition

Decomposing a problem into several related objects and then decomposing those objects again into even simpler related objects allows for the reduction of the complexity of a problem and makes it easier to deal with.

New cards

Explore top notes

note Note
studied byStudied by 26 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 26 people
Updated ... ago
4.0 Stars(2)
note Note
studied byStudied by 4 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 46 people
Updated ... ago
5.0 Stars(4)
note Note
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 857 people
Updated ... ago
5.0 Stars(6)

Explore top flashcards

flashcards Flashcard36 terms
studied byStudied by 7 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard223 terms
studied byStudied by 61 people
Updated ... ago
4.5 Stars(2)
flashcards Flashcard34 terms
studied byStudied by 5 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard51 terms
studied byStudied by 9 people
Updated ... ago
4.0 Stars(1)
flashcards Flashcard58 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard72 terms
studied byStudied by 69 people
Updated ... ago
4.5 Stars(2)
flashcards Flashcard60 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard383 terms
studied byStudied by 142 people
Updated ... ago
5.0 Stars(2)