Skip to content

thenewcircle/java-kickstart-20121217

Repository files navigation

Java Kickstart for Test Developers, 17-19 December 2012

Objects

  • fields: properties (some immutable, some mutable)
  • methods: behavior (may affect the mutable state)
  • identity:
    • reference identity: based on memory location, using ==
    • structural identity: based on object fields, using .equals(). Only immutable (final) fields should be used for this.

Unit Testing

White-box, specifying behavior for the smallest atomic chunks of code.

  • positive testcases: things work as expected
  • negative testcases: things fail as expected

Collections

Important ones:

  • Collection<E>
    • List<E>
      • ArrayList<E>
      • LinkedList<E>
    • Set<E>
      • HashSet<E>
      • SortedSet<E>
        • TreeSet<E>
  • Map<K, V>
    • HashMap<K, V>
    • SortedMap<K, V>
      • TreeMap<K, V>

Concurrency

Benefits:

  • parallelism (multithreading): ability to do multiple things at the same time
  • performance: things don't have to wait for each other
  • resource utilization: take advantage of multi-core / multi-processor hardware

Problems:

  • race conditions: two threads are trying to modify shared memory or shared resources simultaneously
  • deadlocks: two or more threads with a lock graph cycle
  • thread starvation: one thread acquires a lock and holds it forever, or thread scheduler is never allowed to context switch

Solutions:

  • monitors (locks / mutexes / critical sections), synchronized methods or blocks
  • semaphores (wait + notify)
  • ... better solutions: BlockingQueue and other utilities in java.util.concurrent

Videos

Day 1

Day 2

Day 3

Resources

  • "Effective Java"
  • "Java Concurrency in Practice"
  • "Design Patterns"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages