open/closed principle
classes + libraries should be open for extensions but closed for modifications
single-responsibility principle
a class should only have a single responsibility; only one factor should change how the class functions
Liskov principle
subclasses should be uszable anywhere the superclass is expected without breaking the program
interface segregation principle
many client-specific interfaces are better than one general purpose interface;
dependency inversion principle
high-level modules should not depend on low-level modules; both should depend on abstractions; abstractions should not depend on concrete implementations, but concrete implementations should depend on abstraction
SOLID
single-responsibility; open-closed; liskov; interface segregation; dependency inversion
Java bytecode
.class files are filled with bytecode– binary– so it can be run on the JVM;
package
organize code by grouping related classes; similar to a folder
inheritance
a child class inherits methods and other features from a parent class; class Subclass extends Class
project management
HTTP
HyperText Transfer Protocol; request-response protocol where text has interconnected content; transfer information between networked devices
HTTP has no state
each indication of something doesn’t depend on a past result;
ex: logging in only relies on the current request for a password. you log in if it’s correct, even if the previous one was wrong
interface
build a class without concrete definition; “empty” methods
implementation w inheritance
class className implements inter1, inter2 {
class className extends onlyOneSuperclass {
@Override
use before an inherited method to change its behavior / modify for this class
annotations
usually for the purpose of the reader/programmer; JUnit relies on annotations (@Test) but little else does
@Test
tells JUnit where unit tests are located to run them
JUnit
automated testing framework for Java
JVM
engine that runs Java programs; takes .class files and bytecode and executes them
javac
java compiler; turns .java into .class to be run by the java virtual machine
a class may implement many/one:
many interfaces, but only extend one superclass