User:Muffingg/CommonDev

The following are the notes for Common Development of the Java Course

= Exam =


 * Different components of the diagrams
 * Understanding the theory
 * Class Diagram - Dependency Connectors [slide]
 * 30 qs common dev good practices (100%) MCQ
 * All design patterns
 * Five steps to follow test driven development
 * Will have a (mean) Liskov Substitution
 * 2x N Tier questions
 * Source Control will come up in the exam
 * what happens when you commit (creates a new copy)


 * Sign off interview will require n-tier
 * Sign off interview will include server affinity and database clustering


 * Use Case Diagrams
 * Entity Relationship Diagrams
 * Activity Diagrams

= Object Oriented Programming =
 * Everything is dealt as an object
 * Class like a blueprint of how something could be, object is the realisation of the class
 * Classes have behaviour and attributes

= Class Diagram =
 * Class Name, Attributes, Methods
 * '-' is private, + is public (everything can see it), # is...
 * passing argument is the ...(...)


 * interfaces only have static and final attributes (examples of constant variables)

Generalisation

 * Public abstract class User
 * Public class Broker extends User (solid arrow)

Realisation

 * public interface Automated
 * public class Broker implements Automated (dotted arrow)

Dependency Connectors

 * Dependency
 * Association
 * Aggregation
 * Composition

Abstract

 * Attributes
 * Methods

= Sequence Diagram =
 * Alway starts on the left
 * Initial bar is longer than the others
 * Actor / Class at the top
 * Method is the arrow right
 * Return value is the arrow left

= 4 Pillars =

SVN vs GIT
Commit with SVN you create a new version (you cannot rollback)

Object Oriented Paradigm
Made up of objects: Attributes & Behaviour

The act of grouping together data and

Information Hiding
private - only visible to same class protected - public - visible to everything default

static means it belongs to the class itself

= Design Patterns =

Singleton

 * Has get instance (generally speaking) (it is static)
 * Needs a private constructor so it can only be created within itself
 * Not suitable for users

Factory Pattern

 * Public static
 * To create a lot of objects of the same type
 * Make the code less coupled and remove the 'new' keyword

Object Pool

 * Has a max & min connection
 * They are singletons (only one pool exists)
 * Improves system performance (don't need to create connections every time)
 * Limits the number of objects created (amount of memory used at a time)
 * Always has 2 Lists (of available connections and of currently used connections)

Observer

 * An object that observes the state of another object
 * When you want one thing to happen when a state changes somewhere else
 * notify method

Command

 * e.g. undo button
 * store information so that it can be executed at a later time
 * <>
 * Invoker, Receiver, Client, Command
 * Invoker and Receiver 'don't know' about one another
 * Doesn't have to be called Command and execute
 * You can pass in values

Adapter

 * Used for converting one thing into another
 * Will usually say adapter / converter

= SOLID Principles =

Single Responsibility

 * A class should only have methods related to a certain task
 * Can have more than one method ( Trade could have getInfo, Update, Add, Delete )

Open Close

 * A class should be open to extensions and close for modifications

Dependency Inversion

 * Classes should depend on abstract concepts rather than concrete implementations
 * Have a general format and then pass any type of 'thing' in it.
 * Extensions from a parent class should always reference the parent class and not the child class

= Test Driven Development = 75% of the code we write has to have tests written to it

Five steps to follow 1. Write the test 2. Make the test compile 3. Watch the test fail	(most important) 4. Do just enough to make all tests pass 5. Refactor and generalise

= Architecture =

MVC Model

 * View - display info
 * Model - business logic, data, real things
 * Controller - delegating tasks between view and model
 * Example of encapsulation

MVP - Model View Presenter
View - Presenter - Model - Used for automated testing P and M are for backline developers No relationship between view and Model

N-Tier Architecture
Client (Business Logic) __> Server (Database) A slow network

= Source Control = Central Repository holds the system Allows us to share projects in multiple groups

Load Balancer
Stores client IP and what IP request their request was sent to (Server Affinity)

To access SVN
SVN://192.168.0.2:5500/kamran.adnan From Home:	SVN://unix.fdmgroup.com:5500/kamran.adnan

Eclipse Setup
Install JDK 8 followed by JRE (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)

Maven: http://download.eclipse.org/technology/m2e/releases/1.6/1.6.2.20150902-0002

SVN: Install Software > Mars > Collaboration > Subversive SVN Team Provider

SVN Repository: svn://unix.fdmgroup.com:5500/kamran.adnan (No User / Password)

Show View > Package Explorer

Add the following to the Dependencies:

junit junit 4.11      test org.mockito mockito-all 1.9.5      log4j log4j 1.2.17

Install EclEmma (http://www.eclemma.org/installation.html)