Seminar sylabus PV260 (Groups 01, 02)
RNDr. Stanislav Chren, Ph.D.
Seminar sylabus PV260 (Groups 01, 02)
Info
Období
jaro 2016
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 22. 2. 2016 do 28. 2. 2016.
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 29. 2. 2016 do 13. 3. 2016.
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 14. 3. 2016 do 27. 3. 2016.
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 28. 3. 2016 do 10. 4. 2016.
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 11. 4. 2016 do 24. 4. 2016.
Učitel doporučuje studovat od 25. 4. 2016 do 8. 5. 2016.
Kapitola obsahuje:
1
Studijní text
Učitel doporučuje studovat od 9. 5. 2016 do 22. 5. 2016.

Seminar 1 - Introduction, Essential tools

Content of the seminar sessions

The purpose of the seminars is to provide hands-on experience with the topics discussed on the lectures. The seminar content will cover various areas of software metrics analysis, code refactoring and testing. The students will analyse and optimize multiple software quality attributes, such as reliability, maintainability, testability or performance with the help of modern open source tools. The students will work in pairs on exercises during the seminars and on larger assignments (projects) at home. The attendance on the seminars is mandatory. Although, the seminars focus on the Java programming language, the principles discussed on the seminars are generally applicable also in other languages and environments.

Requirements

The maximum number of points to be obtained in the course is 100 and the required minimum for passing is 70. The distribution of the points is as follows:

  • Active participation in lectures : 10 points
  • Achievements in seminars (completing bonus tasks, nice solutions, extra activity etc.): 10 points
  • Projects : 45 points
    • Assignment 1 (Refactoring): 15 points
    • Assignment 2 (Testing): 15 points
    • Assignment 3 (Performance testing, Static Code Analysis): 15 points
  • Final colloquium assessment: 35 points

Penalties

  • Every second (and afterwards) unexcused absence (note that one is allowed, and the first seminar session does not count):
    • -6 points.
  • Late submission of project or assignment:
    • -3 points for each team member.

Content of each seminar:

  1. Seminar organization, general introduction, Essential tools
  2. Clean Code and SOLID principles
  3. Code smells, Refactoring - refactoring existing project and adding new functionality, tuning performance of the project, scalability
  4. Testing - Advanced JUnit techniques, Data driven testing, Hamcrest matchers, Mockito
  5. Testing - Feature/Product testing, Test plans, Google ACC method, Risk Management, Selenium, Issue processing
  6. Performance testing with PerfCake, Profiling java applications with JProfiler
  7. Static code analysis - Checkstyle, Code reviews, Continuous Integration

Projects

  • There will be three larger assignments (separate mini-projects)
  • First will focus on code refactoring, second on unit testing and third on the performance testing and static code analysis
  • The deadline for each assignment will be 2-3 weeks
  • Students will work in pairs
  • Each project will have set of optional (and more challenging) tasks, whose completion will be awarded by bonus points

Basic study sources

Books

  • Clean Code: A Handbook of Agile Software Craftsmanship
    • Robert C. Martin
    • Link
  • Refactoring to Patterns
    • Joshua Kerievsky
    • Link
  • Refactoring: Improving the Design of Existing Code
    • Martin Fowler
    • Link
  • xUnit Test Patterns: Refactoring Test Code
    • Gerard Meszaros
    • Link

Web

Tutorials

Seminar 2 - Clean Code, SOLID principles

Seminar 3 - Refactoring

Refactoring

Project for Seminar

Assignment 1: Code Refactoring

Further Reading

11de8e -> b2a1ab
    Rename Method Ctrl+R
    Replace Magic Number with Symbolic Constant
    Dead Code

b2a1ab -> ffa4c9
    Extract Class
    Move Method Ctrl+M (Right -> Refactor -> Move)
    Extract Method  Alt + Shift + M (Right -> Introduce -> Method)
    Introduce Parameter Object
    Replace Error Code with Exception

    create ParsedArgs (Extract Class)
    create InvalidInputException - for now empty (Replace Error Code with Exception)
    move methods to ParsedArgs (Move Method)
    first extract method to move it - isValidNumberOfArgs (Extract Method)
    same with pixel size
    pass whole arr to ParsedArgs at once
    ParsedArgs can be used as parameter itself - getters (Introduce Parameter Object)
        or extract needed fields in method calls
    throw exception on first error - no true/false, throw immediately (Introduce Parameter Object)
    aggregate errors (just show idea, git checkout to actual)

ffa4c9 -> 85d9e8
    Extract Interface

    compose methods in main
        colorize, prepareOutput, outputAscii, outputPng
    ass size() to FractalGrid to be used in colorize()
    AsciiImageConv extract interface colorFor() - only signature, regex from ctor
    Extract Class to hold current implementation

85d9e8 -> 8c6c69
    Replace Data Value with Object
    Primitive Obsession

    define the required interface - get x,y set x,y, wid, hei
    Matrix, ArrayBackedMatrix
    use current code for implementation - arrayBacked
    replace all occurences by Matrix -ImgConv, Ascii, Png, FractalGrid, RegexFract
    extract method symbolCount(rows, cols, pix) in Ascii

8c6c69 -> cf9506
    Refused Bequest
    Add Parameter
    Extract Superclass
    Pull Up Method
    Form Template Method

    need to know if dealing with Ascii or Png
    Png should not extend Ascii - validPixelSize was already checked, no need to do again
    ImageConverter is not abstract enough - we need to hack with side effects (Refused Bequest)
    refactor to also take the output file (Add Parameter)
        could be even more abstract (-> OutputStream)
    extract AbstractImageConverter (Extract Superclass)
    extract methods in subclasses, then pull up (Pull Up Method)
        convertStart, rowStart, writePixel, rowEnd, saveResult
    StringBuilder gridBuff and rowBuff to fields

cf9506 -> ac67d1
    Switch Statements
    Replace Type Code with Class
    Replace Type Code with State/Strategy

    create new Quadrant class
        for now no behavior, only defined set of well named constants (Replace Type Code with Class)
    move addend methods to Quadrant (Replace Type Code with State/Strategy)

ac67d1 -> 242e26
    Temporary Field
    Replace Type Code with Subclasses
    Replace Constructor with Factory Method
    Push Down Method

    pass parent as parameter instead of individual fields
        size has to be made into field
    extract method createChildren()
    children field not always used, calculate on demand
    create two subclasses based on isLeaf (Replace Type Code with Subclasses)
        FragmentLeaf, FragmentSplittable
    move constructors to respective subclasses, keep isField
    push down writeChildrenTo(), child creation (not used by leaf), remove isField
    split Splittable into Intermediate and Root

Seminar 4 - Testing, TDD, Mockito

Seminar 5 - Testing, Issue processing

Seminar 6 - Performance testing, Profiling

Seminar 7 - Static Code Analysis, Code review, Continuous integration