User:Muffingg/CommonDev

Common Dev Java Week 1 Java Week 2 Java Week 3 Java Week 4 Java Week 5

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

Pillar Description
Abstraction Abstracting only the required information
Polymorphism Relates to there being multiple forms or versions of the same type of thing and the same types of behaviour.
  • Early Binding: Method Overloading Compile Time
  • Late Binding: Method Overriding (where a parent i.e. interface defines method and child class defines solution) Runtime
Inheritance Getting all the attributes from the parent class
Encapsulation Grouping data, behaviours, classes together into logical groups

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

Creational

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)

Behavioural

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
  • <<Lightbulb switch example>>
  • 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

Structural

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

Liskov Substitution

Inheritance

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:

 <dependencies>
   <dependency>
     <groupId>junit</groupId>
     <artifactId>junit</artifactId>
     <version>4.11</version>
     <scope>test</scope>
   </dependency>
   <dependency>
     <groupId>org.mockito</groupId>
     <artifactId>mockito-all</artifactId>
     <version>1.9.5</version>
   </dependency>
   <dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.17</version>
   </dependency>
 </dependencies>

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

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.