1/49
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
waterfall process model
requirements
design
implementation
verification
maintenance
6 reasons for project failure
functionality issues
substantially late
quality issues
high cost variance
canceled after launch
rejected or not implemented for other reasons
three steps in a SW project
analysis
design
implementation
what superseded the waterfall model?
Agile Software Development, managed by Scrum
build software incrementally
use short 1-4 week iterations
keep development aligned with changing needs
ISA
instruction set architecture
machine code
compiled languages
translated into machine code ahead of time by the compiler
compiler produces an executable file that runs directly on the CPU
fast and efficient at run time
must be recompiled separately for each machine architecture/OS
interpreted langauge
code is read and executed line by line by an interpreter
can move the same program between different systems and run it unchanged
slower since each instruction is translated at runtime
java language
compiles into java bytecode and runs on a Java Virtual Machine
that same bytecode can be run on any machine with a JVM
JVM uses a JIT (just in time) compiler, which watches which parts of the code run a lot, then compiles those hot spots into machine code (pretranslated)
portability of interpreted languages + efficiency of compiled languages
Local Version Control System
database of changes on local computer
delta base version control
stores a base version and then only saves the specific changes for each version
no collaboration
example: revision control system
Centralized Version Control System
entire version database is stored on a central network server
supports collaboration
workflow:
sync with VCS server
update to latest version from VCS
work on local version
commit changes to VCS (after potential conflict resolution)
single point of failure
if a server goes down, no one can save their work
Distributed Verson Control System
everyone gets a clone of the repository, including its full history
if central server crashes, repository can be restored from any local copy
workflow:
commit: save changes to local repository history
push: to share local commits to the upstream repository
Git is the actual software
Github provides the central repository
Git
series of snapshots of a miniature file system
no duplicate files as snapshots share references to identical files
operations are local because I have a fully copy of snapshots and history
checksum SHA-1 Hash key used as id for files/folders
Git: 3 states for a file
committed: data is safely stored in the local database
modified: file changed but not yet committed to local database
staged: modified file is marked in its current version to go into the next commit snapshot
trunk(green)
main line of development
Git: “master” branch (default) or main branch
tag(blue)
release, a full snapshot of a version that is not supposed to be changed
branch (yellow)
side tracks to the trunk line that results from maintenance, bug fixes of released versions, or as a general stratedgy to support team work and concurrent development
merging occurs if one wants to incorporate improvements from a branch into the trunk
hardware has separate units for integer and floating point arithmetic
basic types for discrete numbers: integer, short, long integer
basic types for floating point: float, double precision
program counter (PC)
special register in the CPU that holds the memory address of the very next instructions to be run
After the CPU finishes an instruction, the PC increments to the next address (pc + 1)
heap
large, less structured pool of memory available
memory can be allocated (requested) and deallocated (released) at runtime
garbage collection
finds any objects on the heap that are no longer being used by the program and frees memory
Java’s type system tells the program how to interpret raw bit patterns
it is important to initialize variables bc it might contain leftover garbage
Dynamic data structures
it can always request more memory from the heap as it grows
volatile memory
short-term memory that requires constant power to maintain its data, losing everything when the device is turned off
RAM
CPU cache
main memory
persistent memory
long term storage that retains its data after power is turned off
SSD, hard drive
object-oriented programming
a paradigm that bundles data (attributes) and the functions that operate on that data(methods) into a single unit called an object
encapsulation
practice of hiding an object’s internal data and complexity, exposing only safe, public methods for interaction
polymorphism
the ability to treat objects of different types as if they are the same, as long as they share a common role/interface
allows for flexible and reusable code
ability to select different methods (of same signature) according to the actual type of an object
package
a mechanism for organizing related classes and interfaces into a group/namespace
implemented as sub directories on the file system
class
fundamental coding unit
can only have one public class per file
it is reccomended to give each class its own file
non static method
belongs to a specific instance of a class
works w/ the unique data (attributes) of that instance
must create an object first to be able to call the method
static method
belongs to the class itself, not to any one object
a general function that doesn’t depend on the state of a specific instance
can call it directly on the class without ever creating an object
try{
}
finally{
}
guaranteed to execute after the try block, regardless of whether an exception was thrown or not
primary purpose is for resource cleanup, such as closing files or network connections
unchecked exception
represent a bug/logical error
things the programmer could have and should have prevented
the compiler doesn’t check to see if you handle them
NullPointerException
ArrayIndexOutOfBoundsException
checked exception
expected probemems with external resources that a correct program might encounter
compiiler checks your code and forces you to acknowledge that this error might happen and have a plan for it
if you call a method that is declared to throw a checked exception, you have to handle it with a try-catch or a throw
IOE exception - if a file is deleted or network connection is lost
primitive type
value is stored directly in memory
byte, short, int, long, float, double, char, and boolean
tokenization
the process of splitting a string into a sequence of smaller strings, called tokens
based on a separater called a delimiter
hasMoreTokens()
boolean method that returns true if there are more tokens left to process
used as the condition for a while loop
nextToken()
returns the next token as a string and advances the internal cursor
countTokens()
returns the number of tokens remaining to be processed
parseInt()
static method that takes a string and returns the corresponding int
call stack
stores local variables for primitive types
for object types (String, ArrayList) : stores a reference that points to where the actual object lives on the heap
object state
constructor establishes a valid initial state
an object can use its state to control the order in which its methods are called
interface
a contract that defines a set of abstract method signatures
what a class must do, not how
a class that uses “implements” promises it will provide the code for all methods in the interface
enables polymorphism, allowing to write code that works with any object that fulfils the contract
static field
a variable that is shared across all instances of a class
only one copy of a static variable, no matter how many objects you create
constant
static final
only one instance of this variable associated with the class
its value can never be changed after it is initalized
what is the superclass of all objects?
java.lang.Object
HashMap
a data structure that stores key-value pairs
uses a key’s hashCode() to find the correct array index for storing/retrieving a value
then uses equals() to find the exact key in the bucket, which is needed to handle hash collisions
if two objects are equal, they must have the same hash code
superclass
you can use a subclass object whenever a superclass object is expected
a subclass method can’t be more demanding/stricter about its inputs then its parent method
user super.method() to call a method from your direct parent class
climbs are just one level in hierarchy
For constructors:
super() used to call a constructor from the direct parent class
it must be the 1st statement
if a subclass constructor doesn’t call super, the superclass must have a constructor with no parameters
SOLID principles in OO Design
S: single responsibility principle
class should only have one responsibility
concerns: effect of changes, complexity of a class, class reuse
O: Open/Closed principle
software entities should be open for extension, closed for modification
concerns: inherit from abstract base classes, keep interface fixed
L: Liskow’s substitution principle
objects in a program should be replaceable w/ instances of their subtype w/o altering the correctness of the program
I: interface segregation principle
many client-specific interfaces are better than one general-purpose interface
D: dependency inversion principle
depend upon abstractions
don’t depend on concretions
The percentage of large software development projects (budget exceeds $1M) that fail is in the following range (based on a Gartner study of 2012)
20-40%
what is method signature?
method name
parameter list
java primitive types
byte
short
int
float
long
double
boolean
char
Wrapper classes
Byte
Integer
Short
Double
Long
Float
Boolean
Character