Level 105 Level 107
Level 106

[Quiz] Object Oriented


155 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
}instantiation
creating an object with the "new" operator, eg. str1 = new String("hello");
class
All Java methods must be contained in a ...
object
instance of a class. A software bundle of related variables and methods used to model real world objects. It has 2 defining characteristics - STATE and BEHAVIOR. State is stored as variables and behavior is represented using methods
static
Indicates that a variable or method belongs to a class, rather than to any object created from the class.
constructor
Used to instantiate (create) an object of that class
field
A software object's state is stored in a
Methods
It is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.
inheritance
allows a class to be a subclass of a superclass and thereby inherit public and protected variables and methods of the superclass. A parent/child relationship.
encapsulation
helps hide implementation behind an interface or API
overridden.
Final methods cannot be ...
Application Programming Interface
What does the term API stand for?
instantiation
creating an object with the "new" operator, eg. str1 = new String("hello");
Object-Oriented Programs
Create Classes
Graphical Interfaces (GUIs)
Object-Oriented programming was used most frequently for two major types of applications which are
Are all object-oriented programs written to use GUI?
No (not all object-oriented programs are written to use GUIs)
What is object oriented programming?
The idea is creating data classes. It allows a programmer to create any new data type that is not already defined in the language itself representing objects.
Data encapsulation
Hiding internal states and requiring the interaction to be performed through the object's methods.
First benefit?
Modularity: The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily passed around inside the system.
Second benefit?
Information hiding: By interacting only with an object's methods, the details of its internal implementation remain hidden from the outside world.
Third benefit?
Code re-use: If an object already exists (perhaps written by another software developer), you can use that object in your program. This allows specialists to imple…
Fourth benefit?
Pluggability and debugging ease: If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement. This is analogous to fi…
What is an interface?
A group of related methods with empty bodies. To implement this interface, the name of your class would change (to a particular brand of bicycle, for example, such as ACMEBicycle), and you'd use the implem…
What Is a Package?
AA package is a collection of classes and interfaces that provides a high-level layer of access protection and name space management. Conceptually you can think of packages as being similar to different folders on …
related methods ,empty,
In its most common form, an interface is a group of _______ with _______ bodies. A bicycle's behavior, if specified as an interface, might appear as follows:-
implements
What keyword at the beginning of a class groups with an interface?
public, methods
To actually compile the ACMEBicycle class, you'll need to add the _______ keyword to the beginning of the implemented interface _______.
API
Application Programming Interface. The specification of how a programmer writing an application accesses the behavior and state of classes and objects.
state, behavior
Real-world objects contain _______ and _______.
fields
And object stores it states in _______.
encapsulation.
Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data _______.
superclass, subclass, extends
Common behavior can be defined in a _______ and inherited into a _______ using the _______ keyword.
interface
What is a group of related methods with empty bodies?
package
What is a namespace containing an organized set of related classes and interfaces?
static final int numGears = 6;
Make a static variable called "gears" that never changes and is 6;
What is a requirements document?
A precise specification of what the software should do.
Design Stage : identifies the components(classes) to be used and the relationships among them.
What is the difference between design state and the implementation stage in the development of software?
The state of a class consists of the values of its fields.
What is the difference between the state and the behavior of a class?
What is an abstract data type?
I a specification of the type's operations: what an instance of that type can do.
Public: are globally accessible.
Difference between public, protected and private?
abstract data type vs abstract class
A java abstract class is a class with at least one abstract method and no body.
Constructor vs Method
A Constructor is a member function of a class that is used to create instances of that class. It has the same name of the class itself, has no return type and is invoked using the new operator.
Class method vs Instance method
An instance method is declared without the static modifier and is invoked using the name of the object to which it is bound.
what is an enum type.
The enum type is a type defined with the enum keyword that list by name each possible value for the type.
What is the difference between composition vs aggregation.
Composition, is when a type is composed of another type, the complete existence of that component type's objects is controlled by the composing type's object; The components are uniquely bound to it and canno…
Inclusion Polymorphism
It refers to the ability an object to invoke a method that it inherits;
ad hoc polymorphism
overloading and coercion are two special kinds of ad-hoc polymorphism
Coercion Polymorphism : ad-hoc
Occurs when a value of one type is implicitly converted to a value of another type when the context requires that other type.
Overloading Polymorphism : ad-hoc
It means integer addition when used in form 22 + 33; it means floating point addition when used in the form 2.2 + 3.3; and it means string concatenation when used in the form + ", esq."
...
UML Notation
Object-Oriented Analysis
A means of determining what aspects of a given problem can be viewed as objects in an eventual object-oriented design.
Object-Oriented Design
A software design method that models the characteristics of abstract or real objects using classes and objects.
Cohesion vs Coupling
Greater cohesion reflects better design. Less coupling reflects better design.
Roles
Sets of Responsibilities
Roles vs. Objects
They are the same when a given role is always played by the same object type.
Software Components
Reuse of code (e.g. Visual Basic, JavaBean)
Frameworks
Reuse of "plug-in" code (e.g. Java Swing)
Design Paterns
Reuse of Design
Agile Software Development
A philosophy of software development that embraces flexibility and agility. The design "evolves".
parameter Passing
3 Means of Object-Object Access
Has-a Relationship
The relationship demonstrated by a class that contains another class.
Uses-a Relationship
Implemented-In-Terms-Of Relationship
Static Members
Known as "class variables", because there is only one unique value for all the objects of that same class.
this
Keyword used in the body of a method definition when you need to refer to the object to which the method belongs.
super
Similar to the "this" keyword you can use the _______ keyword to refer directly to a superclass
Liskov Substitution Principle
Determine whether a subclass is a subtype
Protected Access
No outside classes can use this data field, except descendant classes. Defeats the purpose of OOP.
Upcasting
Type cast to the type of an ancestor class. Is usually done automatically.
Downcasting
Type cast to the type of a descendant class; may cause runtime errors.
Interfaces
Similar to an abstract class except all its methods are implicitly abstract which means they must be implemented by the class that "implements" the interface. A class can implement as many Interfaces as it li…
Marker Interface
An interface with no methods or fields
Generalization (Base Use Case)
A way to indicate that a given use case is a variation of, or specific version of, another use case. [Closed Unfilled Arrow]
Extension
A way to indicate limited ways a use case can vary (e.g. Delete Message, current or all?) <<extends>>
Includes
A way to indicate steps that occur in more than one scenario. (e.g. Validate Pin)<<includes>>
Associated Scenario
The detailed steps of a use case.
composition
Represents real-world whole-part relationships, e.g., an engine is a part of a car
Aggregation
A type of composition in which a class contains one or more members of another class that would continue to exist without the object that contains them.
Dependency
Used to show that some UML element or a set of elements requires, needs or depends on other model elements for specification or implementation
Multiplicity
Minimum and maximum number of occurrences of one object for a single occurrence of related object
Role Name
Signifies the role that a participating entity type plays in each relationship instance. In some cases the same entity type participates more than once in a relationship type in different roles.
Sequence Diagram
A type of diagram that shows objects participating in interactions and the messages exchanged between them.
Iterator Pattern
The design pattern that provides a way to access the elements of an aggregate object sequentially without exposing the underlying representation.
Adapter Pattern
The design pattern that translates one interface for a class into a compatible interface.
Facade Pattern
Simplifies the interface of a group of classes. Hides the complexity of one or more classes behind a clean, well-lit facade. Makes an interface simple. Provides a unified interface to a set of interfaces in a subsystem.
Object-Oriented Analysis Stage
Determines the requirements of a system
Law of Demeter
Single Dot Rule
Void return type
this kind of method does not return a value and represents a command.
Non-void return type
type of method that represents a question and has a return type. It has a return value and has a return statement.
parameter
Methods can have parameters to provide additional information for a task.
Int
If there is a method "sum(int x, int y)", what is the return type?
Boolean
Binary data type
signature
The header of a method is called its signature. It provides information needed to invoke that method.
Actors
objects that can be placed in the world.
Subclass
a class that represents a specialization of another.
Source Code
The source code of a class determines the structure and behavior (the fields and methods) of each of the objects of that class.
Compilation
source code needs to be translated into machine code before it can be executed.
Return value
methods enable us to get information from an object via a method call (we can use methods either to change an object's state or to find out about its state).
Reserved (key) words
terms are used frequently and interchangeably (like "public" or "class"). There are around 50 of these in Java and they never contain uppercase letters.
comments
Java has three ways of marking comments.
variables
used as a general term for things that store data in a program.
Scope (block)
Defines the section of source from which the variable can be accessed.
Assignment statements
store the value represented by the right-hand side of the statement in the variable named on the left.
expression
aValue = 8933.234;
Accessor methods
return information about the state of an object.
Mutator methods
change the state of an object.
method System.out.println
prints its parameter to the text terminal
Conditional statement (if statement)
takes one of two possible actions based upon the result of a test.
Scope highlighting
help to clarify logical units of your program.
Abstraction (know as divide and conquer)
the ability to ignore details of parts, to focus attention on a higher level of a problem.
Modularization
the process of dividing a whole into well-defined parts that can be built and examined separately and that interact in well-defined ways.
Classes define types
a class name can be used as the type for a variable. Variables that have a class as their type can store objects of that class.
Object diagram
shows the objects and their relationships at one moment in time during the execution of an application. It fives information about objects at runtime and presents the dynamic view of a program.
Object references
variables of object types store references to objects.
Class bodies
contain fields, constructors and methods.
ObjectType
looking at references.
Logic operators
operate an Boolean values and produce a new Boolean value as a result (3 most important logic operators are and (&), or (?) and not (!))
Internal method calls
method can call other methods of the same class as part of their implementation.
External method calls
method can call other Methods of other objects Using dot notation.
Modulo operator
returns the remainder of an integer division. It symbolizes by %.
Name overloading
the same name being used for two different entities.
Step button
to step to the end of the method allow us to see the path the execution takes.
Step Into
step into the method being called and stop at the first line inside that method.
null
What is the default field of the String type?
Collection
a collection object can store an arbitrary number of other objects.
Class library
usually contain tried-and-tested collection classes.
ArrayList
a class that supports dynamic arrays that can grow as needed. That is, an ArrayList can dynamically increase or decrease in size.
Generic classes
do not define a single type in Java, but potentially many types.
Loop variable
a new local variable that will be used to hold the list elements in order.
While Loop
informal name for the while statement
Definite iteration
once the loop starts, you know for sure how many times the body will be executed, this will be equal to the size of the collection.
Indefinite iteration
action will be repeated an unpredictable number of times, until the task is complete.
Iterator
A(n) _______ is an object that produces each element of a collection, such as a linked list, one element at a time.
For-each loop
allows iteration over a whole collection.
Lot class
stores a description of the lot, a lot number and details of the highest bid received for it so far.
Auction class
provides further illustration of the ArrayList and for-each loop concepts.
array
public Polygon polygonFrom(Point... corners) {
Java library
contains many classes that are very useful. It is important to know hot to use the library, thousands of classes, library classes are often inter-related, arranged into packages.
TechSupport
program intended to provide technical support for customers of the fictitious DodgySoft software company.
Java Class library documentation
shows details about all classes in the library.
Interface of a class
describes what a class does and how it can be used without showing the implementation.
Implementation of a class
the complete source code that defines a class.
Immutable objects
its contents or state cannot be changed once it has been created (Strings are immutable).
Java Program
Is a sequence of statements(smallest executable unit) that have to be formed in accordance with a predefined syntax.
statements
a syntactical unit in a program
Blocks
Also known as compound statement, are marked by delimiting with braces { }.
Variable Declarations
A statement that typically specifies two things about a variable: The variable's name and the variable's data type. Must be done before it can be used in a program.
Variable names
Strings of any length of letters, digits, underscores, and dollar signs that begin with a a letter, underscore, or dollar sign.
Char
Data type indicative of a single symbol
short
16 bits long. 16 bit integer (-32K - 32K)
Octal
The numbering system using 8 as its base, using the numerals 0-7 as its digits. In programs written in the Java programming language, octal numbers must be preceded with 0.
Integer Literals
Integers embedded into Java source code, can be expressed as a decimal number by any sequence of digits 1-9. Are considered 32 bits long but can be converted by following them with a "L".
long
64 bits long 64 bit intiger
float
32 bits long. 32bit FLOATING POINT
Class scope variables
Name for variables that are used in a class.
IPv4
Internet Protocol version 4, , Uses a header format that is 20 octets and combined with the TCP segment forms an IP PDU or IP Datagram or IP Packet. The source and destination address f…
IPv6
Internet Protocol version 6, IPv6 An extended scheme of IP addresses, using 128-bit IP addresses, that allows for more IP addresses than current system, IPv4, which uses 32-bit IP addresses.