1/38
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
top down development
A software development approach where the overall structure and design of a system is planned first before implementing the specific details. It starts with a broad view and gradually breaks down into smaller components.
procedural abstraction
using methods to define tasks, for example, the hurdle landDown(), passBaton() etc.
call
calling a method, it consists of a method name followed by parenthesis
method declaration
methods consist of a declaration and a body, where…
- declaration includes its access level, return type, name, and params.
- body consists of the statements that implement the method
access level
determines if the other classes can call the method by seeing if the access level is public, private, or protected
access modifier
keywords in the declaration of a method that determines the access level of a method
visibility
the access level of a method can be though of as its visibility
class method
if the keyword static is used, its a class method.
- class methods cant be called from the class itself
- methods that are not class methods must be called from an instantiated object of that class
void
indicates that the method is not going to return a value.
local scope
methods can have their own set of variables, constants, and objects
variables, constants, and object declarations INSIDE of the body of a method have a scope (limited accessibility)
argument
value passed to a method
method overloading
when more than one kind of argument can be passed into a method of the same name as another method
return statement
methods can return value, they can only return ONE value. they must also state their return type in the method declaration
- ex: public static int returnNumber(int x){
//blah blah
}
Documenting methods
methods should have pre and post conditions.
Preconditions are the conditions or assumptions that must be true before a method is executed. They define the state of the system or the inputs that the method expects to work correctly.
Preconditions ensure that the method is called in a valid context.
Postconditions are the conditions that must be true after a method has executed successfully. They define the expected state of the system or the outputs that the method should produce.
Postconditions ensure that the method has achieved its intended purpose.
boundary value
data that is just inside or outside the range of valid values
state behaviour
state of object that refers to the data it stores, behaviour refers to the the action and communication it provides
encapsulation
protecting an objects data from code outside the class
client code
refers to an application that uses 1 or more classes , client can access methods of the class, but cannot directly access the data defined in the class. reinforces the fact that the state of an object can only be changed through its behaviour
class declaration, body
class dec: includes the access level, key word class, class name
body: includes variables, constructors, and methods
constructor member
used to initialize variables in a class
members
variables and methods are called members of a class
accessor method vs modifier method
used to determine value of a variable = accessor method
used to set value of a variable = modifier method
helper method
called from within a class by other methods, they are used to help complete a task, and have access level private
constructors
automatically executed when an object is instantiated
dont have a return type
always have the same name as the class
overloading constructors
used to provide more options when instantiating an object
instance variables/methods
ever object has a copy of its variables called instance variables
accessor and modifier methods are instance methods because they change the state of an object
they must be called by an instance of a class
class variable/methods
each class has only one copy maintained for all objects to refer to
class methods are declared by the keyword static, and can be called by the class itself
object casting
equals() method requires an object param
ClassCastException
when an object variable is cast with an incompatible class
modular
an application that uses components that are seperately written and maintained
inhertiance
a class that inherits the properties and behaviors of another class, promoting code reuse and creating a hierarchical relationship between classes.
polymorphism
objects have the ability to assume different types based on inheritance - subclass overriding a superclass method
abstract
use keyword “abstract”, cannot be instantiated because they do NOT represent objects
they describe the general details and actions of type of object
abstract method
declared with the keyword abstract, but be implemented in its subclass
interface
an interface specifies the behavior of a class by providing an abstract type.
is not part of hierarchy
Interface Comparable
compareToObject(), returns 0 if obect is same, negative if its less than, and positive if its mroe than