Patterns are this lame concept of mapping a desired action with a block of code, making programming more depressing and making you contemplate suicide.
Pattern that finds the sum of a collection of items
type sum = 0;
for (item) {
sum = sum + item;
}
Pattern that prints an item
System.out.println("label"+value);
Pattern that reads an item
System.out.println("prompt");
type var = readingFunction();
Pattern that reads items until signaled to stop
type var = readPattern();
while (var != delimeter) {
f(var);
var = readPattern();
}
Pattern that counts a collection of items
int count= 0;
for (item) {
++count;
}
Pattern that loops over every item in an array
for (int i = 0; i < array.length; i++) {
f(array[i]);
}
Pattern that finds the maximum value in a collection of items
type max = 0;
for (item) {
if (item > max) {
max = item;
}
}
Pattern that loops over every character of a string
for (int i = 0; string.length; i++) {
f(string.charAt(i));
}
Pattern that loops over every item in an array
for (type item : array) {
f(item);
}
Pattern that reads an item, but more efficiently than the read loop pattern
type var;
while ((var = readPattern()) != delimeter) {
f(var);
}
Pattern that loops over every item in a collect and returns a boolean value if any item passes a designated test
boolean anyPattern(type[] array) {
for (type item : array) {
if (condition) {
return true;
return false;
}
Pattern of a constructor that takes literals
public Constructor() { this.a = 1; this.b = 2; }
Pattern of a constructor that takes from user input
public Constructor() { this.a = readPattern("a: "); this.b = readPattern("b: "); }
Pattern of a constructor that takes parameters
public Constructor() { this.a = readPattern(); this.b = readPattern(); }
Pattern of a function that returns a class object
public type getPattern() { return this.obj; }
Pattern of a function that defines sets a class object
public void setPattern(type a) { this.obj = a; }
Pattern that represents a class object as a string
Pattern that produces an iterative menu system
Pattern that does something?
Pattern that removes all matching instances in a list
Pattern that removes the first matching instance in a list
Pattern that returns the first matching instance in a list
Pattern that returns all matching instances in a list
Pattern that creates a second instance of a list
Pattern that sets up an observer; an object that executes when a graphical object is interacted with, containing the following steps
Pattern that encapsulates a class within another class, this allows the inner class to access members from the outer class
Pattern that defines the implementation of an interface instance while being instantiated
Shorthand syntax for creating a function
Pattern that initialises and executes GUI stage
Pattern that returns value in a TextField
private int getValue() {
return Integer.parseInt(textFieldObj.getText());
}
Pattern that sets a value in a TextField
private void setValue(int value) {
return textFieldObj.setText(""+ value);
}
Method of programming without patterns, where you visualise a goal, plan how you want to execute it, and find a key line of code that is the core of said plan, then build the rest of the code around the key. Who would've guessed...
Assume your goal is too broad; start with a smaller goal and slowly grow up to the main goal.
The operator that returns the remainder of dividing two numbers. Has useful properties, as you know
Removing errors from code through tests. Instead of testing every possible value, select a finite set of values that represent each type of possible scenario
Function created by a programmer (not built into language). Two types:
When a function method changes a value; that is bad
List of an arbitrary size, and when exhausted is replaced and copied over to a larger array list
Accessing is in \(O(1)\), and writing is in \(O(n)\), where \(n\) is the distance from the end of the list
List made of objects that have the content and a pointer to the next object
Writing is in \(O(1)\), and accessing is in \(O(n)\), where \(n\) is the distance from the start of the list
Method of specifying types for lists
Layout of the methods of a range of classes
The idea of an object becing able to identify with a more general class as well as its own class, for instance, squares and triangles can find common ground as polygons and be stored in lists together
Act of a class having subclasses that are related to its superclass. If the subclass uses a superclass method differently to the superclass, we declare it abstract in the superclass
Graphical object
Tree of nodes
Locaction where a stage is displayed
Main method for setting up stage
Object that monitors for a specific action of an object and on said action executes a method
An interaction in a GUI application, such as a button being clicked or a mouse dragged on an object
Interface applied to observer class that handles event X
Shortcut for creating functions with no label
XML used to represent JavaFX graphical objects, written in .fxml files
JavaFX and XML object that represents text that can be set
JavaFX and XML object that represents a label for an input form
CSS can be used with FXML, however before each attribute you must add "-fx-", and in the .fxml file, you denote classes as "styleClass" instead of HTML's class
Code containing logic for the data objects
Code representing graphical objects that are observed
Annotation that fills a JavaFX node with FXML data based on an ID that is the same as the variable's name
A namespace is an attribute in an XML object to help avoid collisions with other objects with the same name but different meaning
Code containing observers that observe the view and parse data to the model for logic
Changing property 1 when property 2 is changed with method bind(). You can bind through FXML by writing the property inside a text attribute with {} wrapping around any referenced objects or java code
Binding as well as changin property 2 when property 1 is changed with method bindBidirectional()
Collection of related classes, listed as a reverse domain name withsub-package names (if applicable)
Java/FXML object that displays a list of items of a certain type (either String or an object with a toString() method). There are two modes for this object:
You can set a placeholder for an empty ListView
To make new windows, UTS made a package (au.edu.uts.ap.javafx) that allows to open v, however requires your controllers to extend to the Controller<X> class, where X is the name of the class you are controlling for
use stage.close() in the control controlling the window you desire to close
Java/FXML object that displays a list of items of a certain type (either String or an object with a toString() method). It has a row for each item and a column for each item's property.
You can set a placeholder for an empty TableView