Professional Documents
Culture Documents
ja
grouping objects
class libraries:library useful
of classes
necessary
COLLECTIONS
4CCS1PPA
for each 100p selective processing
programming
practice &
application
/ 1
iterating over
collections
FOR EACH LOOP WHILE LOOP
L
a processing every element
While (loop condition)
a guaranteed to STOP
WHILE LOOD
↑>
may stop halfway through
loop body
-> use for repetition thatdoesn't
ITERATOR OBJECTS
involve a collection
collections
havean iterator()
-> could create an infinite Loop method
constructors methods
+
duplicates ·public static' (variable) name (method)
return type
HASHMAP
key: value parameter names types
CONSTANTS
descriptions of:
~
fixed value once set ·
purposel function
-
'final -
each parameter
~to be set in declaration -
value returned
I constructor
INFO HIDING
WRAPPER CLASS
public elements:accessible
·
primitive types:immutable to objects in other classes
-> be
can't changed post-creation private elements:accessible
only to objects of same class
·
↓ independence
↳ important
f or large systems
~
use:to define of
a set
fixed in length
BASIC ENUM TYDE ·use a special syntax
A B A
B C D -
each name represents an object
-
objects w/ no methods
x provided by other classes
t he enum
of type
COUPLING:
↓ ·
y
COHESION
CODE
Q UALITY
W
CODE DUPLICATION I
·
maintenance harder
↳
-
inconsistencies terrors -
THINKINGAHEen A
4CCS1PPA
changes easier
REFACIORING
classes/methods to be
refactored to maintain
cohesion+ low coupling
programming
-
test before/after refactoring
to ensure nothing:b roken
-class:4 complex
i f represents: I
logical entity
practice &
&
application
S
streams &
lambdas ↓
LAMBDA
SYNTAX
METHODS US LAMBDAS
TYPES (ERRORS)
-
no visibility keyword
automation
syntax errors
-
no return
-
type
-
no name slist (parameters) ->
↳ early errors
ampiler
->
↳
spotted by
separates parameters (statements to executed) -
logic errors
from body
STREAMS
↳ later
errors ↑CHANCESCDETECTION) NLIKELIHOOD CERRORS(
L
-> not
s potted
SYNTAX VARIATIONS -use SE practices Use SE techniques
-
(similar to collections)
leave out parameter - modularisation + good encapsulation
->
type
-
Leave out brackets
-accessed sequentially TESTING+ DEBUGGING
documentation
pay attention to
-
IfI parameter/statement
~
-contents I changed test:presence (errors) cohesion/coupling
write in one line Stream can be infinite JUNIT
debug:s ource cerrors)
-
-
blackbox + whitebox
- .
FILTER PIPELINING
bb:tests functionality
&
new
-
↳
-terminal operations produce is added
a result or void
STREAMS + LAMBDAS TEST DRIVEN
MAP (Intermediate) DEVELOPMENT (TDD)
FILTER (intermediate( -
passes elements which fulfil element + returns new element tests serve as spec's
condition to outputs tream (terminal
REDUCE
when defect reported,
-If boolean Lambda (predicate) true, write a test - make it
p ass
Faccutationarementor
=
ADVANTAGES
a
methods/ ↑
STACKDANE?"BOOT"(
S
~
attributes
SUB TITLE
~ avoids code duplication POLYMORPHISM instance of
(GUIs)
~allows code reuse
can hold objects of more TYPES determines
~ simplifies code LABEL
than one type runtime
dynamic type
~ simplifies maintenance t DYNAMIC:occurs at
whensomething's been
store the
object:u nchanged
runtime check to ensure object
subclassconstructosein SCENECWINDOW CONTENTS
-
-
is of that
t ype PROTECTED ACCESS
ADDING MENUS
↳ class cast Exception public, protected private
↳ Supercauthor); 5 AUAFX PANES
-
superclass:private
if none written, compiler
↳ subclasses:p rotected BORDERDANE, MBOX,
.
&
M
method takes multiple
arguments oft he same type
METHOD CALL METHOD REFERENCE
S
DIALOGS
LABEL
IMAGE won OPAbasalenteracticactions
coding bits
LOAD IMAGE FILTERS
CASTING+COERCION BUTTONS
INCREMENT OPERATORS
BOSTFIX PREFIX
4CCS1PPA
TYDES
BYTE (8 BITS(
FLO AT
SHORT (16 BITS)
INTC32 BITS) DOUBLECDEFAULT
OBJECT EQUALITY
LONG C64 BITS)
REFERENCE EQUALITY
( =
=
3 VISUAL EFFECTS
ISTRING) CONTENTE QUALITY TRANSITIONS
programming
EG.DROPSHADOW, LIGHTING,
REFLECTION
1.2q4a1S())
EG. FADE, SCALE, TRANSLATE
recursion application
MODEL/VIEW/CONTROLLER (MUC(
ISE
VIEW:visible interface
ARECURSIVE FUNCTION CALLS CONTROLLER:Managing user interaction
INDUT ~ separation (concerns) - reusability
TWOTBinte
#
7 -
CALLONE CALL ~ cohesion ~ Loose coupling
OUTPUT -
css styling
DEFINE NEW STYLE CLASSES
STYLE
S HEETS
↳ possible termination
·FINALLY CLAUSE
TRY'STATEMENT
executes regardless of
Whether an exception occurs
PREVENTING OBJECTCREATION
MULTIPLE EXCEPTIONS
file-based I/O
OPEN/WRITE F ILE
TO ICLOSE
>IOEXCEPTIONS
DEFINE NEW EXCEPTIONS
TO FILE
WRITE
READERS,WRITERSSTREAMOSene
Input (char) data (byte)
CHARACTER SETS
ASSERTIONS
ENSURERESOURCEOSE
D
testing correctness of
assumptions made in program
can-RRORAVOAng
( EXCEPTIONS)
:ALTERNATIVE SCANNER
USE FOR INTERNAL CHECKS
supports parsing of
textual input
Emorecovery