2. Java Application as a White Box: designing, coding, debugging and using. 51hrs.
- Training «1. Java Application Building» completion
- Hands-on skill of localizing and fixing deep build-time errors
- Hands-on skill of run-time JVM parameterization
- Understanding Java syntax deep details
- Understanding system design principles and patterns
- Hands-on skill of developing maintainable application
- Hands-on skill of developing error-handling applications
- Understanding Java parallelism and concurrency architecture
- Hands-on skill of localizing and fixing concurrency issues
- Understanding Java Collections API
- Hands-on skill of developing memory-intensive applications
- Understanding Java networking architecture
- Hands-on skill of developing distributed applications
- Understanding Java IO architecture
- Hands-on skill of developing file-persistent applications
- Hands-on skill of IDE productive using
- RAM ≥ 8Гб
- Wi-Fi with Internet access
- github.org :443 :80
- repo1.maven.org :443 :80
- jcenter.bintray.com :443 :80
- Schedule
- Trainer
- Training overview
- Rules
- Pairs forming and introduction
- Attendees prerequisites check
- Topics focus demand from attendees
- Additional topics demand form attendees
- Fork training repo and clone this fork
git clone --branch master --depth 1 https://github.com/ACCOUNT/java-application-development
- Open project with IDEA
- Project JDK set
- Sourcepath and classpathes
- Maven full build
- Application requirements overview
- Application architecture overview
- DevOps pipeline overview
- Methods: why?
- Classes: why?
- Packages: why?
- Single-line comments
- Multi-line comments
- Syntax for documenting methods and classes
- Documenting packages
- Maven download dependencies sources and javadocs
- Using javadocs with IDE
- What entities we should comment?
- What we should describe with comments?
- Comments Quality Gate
- Package
- "Class"
- Class variables
- Method
- Method variables
- Naming things with JCSC
- Package: why?
- Package declaration
- Import directive
- Class: why?
- Class declaration
- Class variables declaration
- Static initialization section
- Method: why?
- Method declaration
- Method body code block
- Returning values
- Methods call stack
- Perm/Meta space
- Dot notation
- Static import directive
- 3 passing styles
- Formal and factual arguments
- Debug session with primitive value passing and monitoring variables
- Overloading concept
- Why?
- Overloading operators and "+" operator
- Read and analyse specification as tests for this iteration in src/test
- Full Maven Build
- Run tests from IDEA
- All given specifications runs are green
- Variable declaration scopes
- Declaration
- Initialization
- Literals
- Default initialization values for class and method variables
- JLS vs JVM implementation
- byte
- int
- short
- long
- float
- double
- char
- boolean
- Wrapper types and main features: referenced, constants, string parsing
- Why?
- Autoboxing/unboxing and performance issue
- Read and analyse specification as tests for this iteration in src/test
- Uncomment specification cases
- Implement features needed
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- type casting
- instanceof
- +, -, *, /, %
- Typed operators: 1/3 vs 1/3.
- Arithmetic types promotion
- ArithmeticException
- Types Overflow and solution with BigInteger
- FP precision loss and solution with BigDecimal
- &, |, ~, ^
- <<, >>, >>>
- Type-stricted
- &, |, !
- Lazy and eager form
- ==, !=, <, <=, >, >=
- Reference types issue: absence of === and .equals()
- Ternary operator
- if
- switch and limitations
- Does switch use == or .equals() for String type?
- for
- do
- while
- "foreach"
- Nested switches and loops
- break
- continue
- labels:
- Procedure Metrics: CC
- Readability and high CC: Extract Method refactoring
- Read and analyse specification as tests for this iteration in src/test
- Uncomment specification cases
- Implement features needed
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Reference + referenced object
- JVM memory structure revisited: Heap object space
- Object structure and its defining class
- Where reference can be placed?
- What is memory consumption for reference?
- What is default value for reference?
- Double-referencing and == vs equals()
- Dereferencing and GC
- What passing style used?
- Side effects concept and its scopes
- Reference passing and memory side effect
- Declaration
- Initialization
- API: addressing, length
- Exceptions
- "Immutability"
- "foreach" cycle
- Milti-dimentional arrays
- Array literal
- Milti-dimentional literal references array walking
- Why?
- Declaration
- Passing
- Using
- Limitations
- Analyzing program arguments as main(string vararg)
- Declaration
- Initialization with literal and constructor
- "Immutability" vs StringBuffer/StringBuilder
- API
- Strings equality: == and .equals()
- Surprise: Strings interning and pool
- Strings interning
- Wrappers interning and limitations
- Read and analyse specification as tests for this iteration in src/test
- Uncomment specification cases
- Implement features needed
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Procedure-oriented application design stub
- Maintainability issues:
SRP,OCP - Refactoring Extract Enum
- Clear code and readability values
- Refactoring Extract Method
- Encapsulation concept and values
- Refactoring Extract class / Move method
- Polymorphism concept and values
- Refactoring Extract Interface
- Inheritance concept and values
- Refactoring Extract Superclass
- Stateful vs Stateless components
- Creational problem
- Creator pattern
- Factory Method pattern and cases
- Abstract Factory pattern and cases
- Registry pattern and cases
- DI pattern and cases: field, constructor, setter, method injections
- Final full UML picture
- 3 modifier semantics
- Enumerated type concept: why?
- API
- Referencing and == vs equals()
- Using with switch
- Smart Enum anti/pattern
- Implementing enum without built-in enum type
- Check if static concept understood well
- Implementing Singleton anti/pattern
- Refactor to Enums: Dumb Commands
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Why?
- Packages and classes as Encapsulation units
- Access modifiers and their order
- Encapsulating state: data hiding with accessors/mutators as OCP implementation for flexibility
- Setters/getters is not encapsulation in general case
- Constructor сoncept
- Differences with methods
- Default constructor
- Variable shading within constructor
- Overloaded constructors and its reuse
- Factory Method Pattern as constructor alternative: OCP implementation for flexibility
- Builder Pattern as constructor alternative: OCP implementation for flexibility
- FR: presentation changes
- Refactor to code reuse with Smart Commands
- Refactor to code reuse with Factory Method pattern
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Type system with "IS-A" relationship: introducing abstract type
- Polymorphic/dynamic/virtual method call:
AbstractType object = new ImplementationType();
- Limitations of visible features
- Static methods shading and its "polymorphic" call
- Type casting operator
- instanceof operator
- Why is it anti-pattern?
- Interface declaration
- Default modifiers for methods and "variables"
- Interface inheritance
- Interface implementation
- Multiple implementations
- Defender methods: static and default, diamond problem
- Polymorphic arrays
- Polymorphic methods arguments
- Strategy Design Pattern
- State Design Pattern
- FR: presentation changes and sink changes
- Refactor to Polymorphic Commands and Appenders
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Abstract modifier
- Abstract class as a case of Abstract Type
- Show-case for interface-like substituting
- Extending abstract class with subclass
- Limitation on parents count
- Limitation on parents member visibility
- Out-of-box reusing all inherited members
- Overriding parents behavior
- Reusing some behavior with super()
- Overriding methods constraints and LSP
- Constructor
inheritanceand why? (interfaces) - Ok google, so how I can call super constructor?
- Constructors call wave for hierarchy: compiler's default super() call
- super() vs this() and its position within constructor
- Object Initialization section
- Implementing Template Method Pattern with abstract superclass
- FR: decoration changes
- Refactor to code reuse with Template Method pattern
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- SRP
- OCP
- LSP
- ISP
- DIP
-
Singleton - Creator
- Factory Method
- Builder
- Abstract Factory
- Registry
- DI: field, constructor, setter, method
- Adapter
- Decorator
- Facade
- Proxy
- Composite
- State/Strategy
- Command
- Mediator (our Controller)
- Observer/Listener
- Visitor
- Typical enterprise application architecture overview with patterns spotted
- Visitor implementation for Expression Problem statement
- Application architecture and design review
- Technical debt fixed in backlog
- Refactor to DI pattern
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Cross-review of technical backlog
- Type information
- Object data information
- Methods call stack information
- creating exception instance
- throw operator
- Methods call stack tracing
- try section
- catch section
- Where in call stack we should handle for typical architecture?
- How we should handle? Log/Retry/Rethow patterns.
- finally section
- Suppression bug
- multi-catch
- try-with-resources
- Typical layered architecture
- Rising exception in deep layer
- Rethrow example
- Exception from main() example
- Suppression example
- Built-in types
- Errors vs Exceptions
- Checked vs Runtime exceptions
- Exceptions type system architecture styles: old-school and hipsta
- Add custom business exception type
- Add handling within application architecture
- Introduce business exception type system
- Implement exception handling
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Mapping test scopes to typical architecture
- Testing pyramid with testability base
- AAA & GWT
- Fixtures
- Assertions
- State-based test scenario
- Interaction-based test scenario
- Running JaCoCo with Maven build
- Analyzing reporting
- What to cover?
- Test case with test doublers and coverage analysis
- Decide what to cover and state your coverage decisions
- Cover application with unit auto tests
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Given type-generic algorithm/data structure: e.g. Optional
- Choosing Object as data type
- Issues with type checks and downcasting
- Type parameters for methods
- Type parameters for class
- Instatiating type-parameterized class
- Type erasure :(
- Type parameters for interface
- Issue with type parameter invariance and complex type parameter patterns
- Patterns for implementing type-parameterized interface
- Infinite data
- Immutable data
- Composing functions around data
- Functions as arguments and return types
- Computation lazyness
- Passing function as parameter as alternative for TM and ST
- Passing Comparator to sort()
- Static nested classes
- Inner (non-static nested) classes
- Local inner classes
- Anonymous inner classes
- Auto passing by name / capturing outer variables
- Captured variable limitations
- Declaring lambdas
- Compiler types inference
- Functional interface
- Method reference
- Alternative implementation for Template Method, Strategy/State, Listener
- Optional API
- Collection API: sorting with Comparator
- Java8 Stream API
- Runnable and Executors API
- CompletableFuture API
- Refactor to ƛ-style: introduce HOFs for main responsibilities
- Introduce data immutability
- Introduce Optional type
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- System
- System properties acessing and setting
- Runtime
- Math: issue with FP types presicion loss
- String: immutable and interned
- StringBuffer & StringBuilder: mutable, thread safe/unsafe + String concat JVM optimization with SB
- Wrapper classes for primitives: immutable and interned, autoboxed/unboxed
- Objects: utility tasks
- Arrays: utility tasks
- finalize()
- toString()
- clone()
- equals() and hashCode() contract
- Implementing cloneable ability
- Implementing equals() and hashCode() for entity class
- Implementing equals() and hashCode() for entity class
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- "Old" collection classes: why replaced?
- Modern Collection API overview: iterating
- Iterator: why?
- Set vs List API overview: unique? ordered? sorted?
- Map API overview
- Queue and Dequeue API overview
- Collections: utility class and basic operations
- Set API
- SortedSet
- NavigableSet
- Buckets
- Load factor
- Rehashing when?
- Treefying
- Performave issue with not setting initial size
- Ordering
- R/B balanced tree
- Comparable objects or Comparator needed
- Rebalancing when?
- Set constraint violation issue with mutable object and equals/hashCode set
- List API
- Array rebuilding
- RandomAccess
- Double-ended linked list
- Map API
- nulls?
- HashMap vs TreeMap: the same
- WeakHashMap
- Queue API
- Dequeue API
- LinkedList
- PriorityQueue
- ArrayDequeue
- Decide and state decision for Collection class for application state handling
- Introduce implementation
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- State for implementation chosen
- Streams and Readers/Writers
- Buffering
- Encoding
- File and Path
- File IO with Stream API
- Simple file operations with utility class Files
- RandomAccessFile
- ObjectInput/OutputStream
- Serializable
- Saving log data to file
- Rotating files
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Socket abstraction
- ServerSocket listener
- Architecture
- API
- CAP requirements
- Remote logging for one client
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Annotation concept
- Compiler annotations
- Annotation processing
- Developing custom annotation
- Class API
- FEST-reflect library
- Class loading API
- JVM Agent concept
- Ops need to configure business logic components with configuration file
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Thread definition
- Scheduler
- Scheduling overhead
- Green vs Native threads
- Thread start
- Thread management
- Thread states
- Priorities
- Daemons
- Blocking operations and states
- Executor and ExecutorService API
- Callable and Future API
- ExecutionException container
- Microbenchmarking common issues
- JMH API
- JMH benchmarking collection operations
- Remote logging for up to 1k clients
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Preemptive parallelism trade-off for atomicity
- Data race concept
- Thread-safety concept
- synchronized method
- New thread state
- Monitor Object
- synchronized() section
- Monitor granularity patterns
- Lock and ReadWriteLock as improved monitors
- JVM optimizations
- CPU core cache syncronization protocol and defult strategy
- Visibility issue
- Reordering issue
- Known synchronized and lock tools
- New volatile keyword
- volatile limitations
- Happens-before relation
- Core happens-before events
- Trade-offs for blocking monitor synchronization
- CAS operation and hardware support
- Atomic data types and reference
- Algorithm patterns on Atomics
- join() and sleep() and new thread state
- Blocking IO and new thread state
- Waiting and new thread state
- Dealing with InterruptedException
- Waiting for event with
polling - Waiting for event with monitor.wait()
- Waking up with monitor.notify()
- Double-checked waking up pattern
- Remote logging for up to 1k clients with correctness prove
- All given specifications runs are green
- Code reuse and minimum code duplication
- Code style
- Unit test coverage metric achieved
- Collections.synronizedXXX is not concurrent collections
- java.util.concurrent Collections overview
- Profits and trade-offs
- ConcurrentSkipListSet
- CopyOnWriteArraySet
- CopyOnWriteArrayList
- ConcurrentHashMap
- ConcurrentSkipListMap
- ArrayBlockingQueue / LinkedBlockingQueue
- ConcurrentLinkedQueue
- Daily retrospectives