George Mamaladze Software Architect Siemens I IA AS

  • Slides: 40
Download presentation

�������� George Mamaladze Software Architect Siemens I IA AS CTO mailto: gmamaladze@gmail. com ����������

�������� George Mamaladze Software Architect Siemens I IA AS CTO mailto: gmamaladze@gmail. com ���������� Ioseb Dzmanashvili Ph. D Candidate Software Architect at Az. Ry LLC mailto: s. dzmanashvili@freeuni. edu. ge

�� ���� SD ������� ? ���������� Continuous Integration Build Test Doubles Unit Tests UML

�� ���� SD ������� ? ���������� Continuous Integration Build Test Doubles Unit Tests UML ��������� IDE & VCS

���� • • • Build - ����� Build Script Build Tool Continuous Integration Managing

���� • • • Build - ����� Build Script Build Tool Continuous Integration Managing Build Dependencies

Build ������� Source Code Executable Help & Doc VCS Distributable Other Artefacts 3 d

Build ������� Source Code Executable Help & Doc VCS Distributable Other Artefacts 3 d Party • Compression • Packaging • Signing

Evolution of Build • Manual Build - It is error prone and inefficient to

Evolution of Build • Manual Build - It is error prone and inefficient to carry them by hand. • Soulution: Build Scripts %CLASSPATH%=C: Program FilesJavajdk 1. 6bin START %CLASSPATH%javac Main. java Cons: • Difficult to manage • Do not recognize dependencies – we always build the „whole world“.

Dependencies Critical for automated tools is knowing dependencies: which project artifact depends on another

Dependencies Critical for automated tools is knowing dependencies: which project artifact depends on another when it is constructed. Knowing dependencies allows to recognize artifacts on affected paths and build just them. Soulution: Build Tool

Build Tool vs Script Build script: The user specifies what will be used, what

Build Tool vs Script Build script: The user specifies what will be used, what to do and the order in which to do. Build tool: The user specifies what will be used (typically source code files) and what the result should be (typically an application), but the utility itself decides what to do and the order in which to do it.

Build Tools The (UNIX) make command requires an input file, called ‘makefile’ (or ‘Makefile’),

Build Tools The (UNIX) make command requires an input file, called ‘makefile’ (or ‘Makefile’), to describe the dependencies between files and how to update them. It consists of multiple entries (production blocks) of the following format: target: [dependencies] commands to build it • Commands are executed if at least one of the dependencies is younger than the target. • To update the target f with respect to the files on which it depends, type ‘make f’ into the shell • Just saying ‘make’ updates the first target named in makefile

make all: hello all hello: main. o factorial. o hello. o g++ main. o

make all: hello all hello: main. o factorial. o hello. o g++ main. o factorial. o hello main. o: main. cpp g++ -c main. cpp factorial. o: factorial. cpp g++ -c factorial. cpp hello. o: hello. cpp g++ -c hello. cpp clean: rm -rf *o hello main. o factorial. o hello. o main. cpp factorial. cpp hello. cpp

Ant make – was overkill for java. One needs rules expressing java native implicit

Ant make – was overkill for java. One needs rules expressing java native implicit dependencies – e. g the dependency between X. java and X. class or expressing source code dependencies. Ant, Another Neat Tool from Apache, is better suited as an for Java projects, and is de facto standard tool for building applications in Java environment.

Ant

Ant

Ant has targets (like make) and tasks. Some of the Ant core tasks: •

Ant has targets (like make) and tasks. Some of the Ant core tasks: • “compile” tasks — depend, javac, apt. . . • “execution” tasks — ant, exec, java, sleep, waitfor. . . • “documentation” task — javadoc. . . • “archive” tasks — jar, manifest, zip. . . • miscellaneous tasks — echo, fail, sound. . . Parameters for execution of tasks. Examples: <fileset>, <classpath>, <path> and <pathelement>, <arg> and many others. Ant is written in (surprise ) Java, has its own API which can be used to define custom task.

MSBuild is a Microsoft build platform works together with Visual Studio is available at

MSBuild is a Microsoft build platform works together with Visual Studio is available at no cost acts on project files which have a similar XML syntax to Ant Difference: Project files are also used by IDE to manage projects.

Maven, the next step Maven – yet another build tool? Maven – is “Java

Maven, the next step Maven – yet another build tool? Maven – is “Java project-management and project-comprehension tool. ” (Apache web site). There are number of issues when using ant if a project has an non-trivial and complex structure, an includes custom defined tasks. Maven solves these problems and includes features which are designed to increase productivity.

Build Automation 3. Continous Integration Software 2. Build Tool 1. Script Compiler, Zip etc.

Build Automation 3. Continous Integration Software 2. Build Tool 1. Script Compiler, Zip etc.

CI Workflow

CI Workflow

Continuous Integration Software • Integrates with VCS allowing Gated Check-Ins (Pre-Tested Commits). • Build

Continuous Integration Software • Integrates with VCS allowing Gated Check-Ins (Pre-Tested Commits). • Build Farm (Build Grid), Test Farm • Integrates static code analyses, code coverage, duplicates search etc. • Integration with Issue Tracking Systems • Support of multiple platforms for mixed apps: Java, . NET, Ruby etc. • Communication: Email, Feed, Messenger etc. • User friendly (web) interface – single enty pint URL

Build Workflows: 1. Gated Check-In Build Unit Test VCS Prevents developers from breaking sources

Build Workflows: 1. Gated Check-In Build Unit Test VCS Prevents developers from breaking sources in the version control system by running the build remotely for local changes prior to commit Recommended duration max. : 5 min

Build Workflows: 2. Rolling Build VCS Get Build Triggered Messaging Issue Track. Integration Test

Build Workflows: 2. Rolling Build VCS Get Build Triggered Messaging Issue Track. Integration Test Is triggered • … in predefined intervals • …after certain number of Ceck-Ins • …as soon as previous is finished Recommended duration: ~ 30 min Reports

Build Workflows: 3. Nightly Build VCS Get Build Package Deploy Is triggered regularily or

Build Workflows: 3. Nightly Build VCS Get Build Package Deploy Is triggered regularily or manually. Is very time consuming ~ 24 h End User Test Label Publish

XFD – e. Xtreme Feedback Device Let Your Project Speak for Itself! http: //programmer.

XFD – e. Xtreme Feedback Device Let Your Project Speak for Itself! http: //programmer. 97 things. oreilly. com/wiki/index. php/Let_Your_Project_Speak_for_Itself

Build Workflows: 3. Nightly Build VCS Get Build Package Deploy Is triggered regularily or

Build Workflows: 3. Nightly Build VCS Get Build Package Deploy Is triggered regularily or manually. Is very time consuming ~ 24 h End User Test Label Publish

Drop Location Storing and versioning binaries (build results): These can be used: • to

Drop Location Storing and versioning binaries (build results): These can be used: • to deliver to customer • as a pre-compiled working base for the next day • long time archive to reproduce customer issues • reproduce defects easily

Build Farm / Grid Multiple servers build in parallel Controller distributes load Agents perform

Build Farm / Grid Multiple servers build in parallel Controller distributes load Agents perform portions of build

Testing in Parallel

Testing in Parallel

App Test Rack

App Test Rack

User friendly (Web) Interface Team City Demo http: //tv. jetbrains. net/videocontent/teamcity-demo-building-maven-with-maven-from-a-to -z-in-5 -minutes

User friendly (Web) Interface Team City Demo http: //tv. jetbrains. net/videocontent/teamcity-demo-building-maven-with-maven-from-a-to -z-in-5 -minutes

Managing Build Dependencies Quick Build is a design issue.

Managing Build Dependencies Quick Build is a design issue.

Dependency Inversion Principle Step 2: Introduce interfaces

Dependency Inversion Principle Step 2: Introduce interfaces

Initial state 100% Stop. Light. dll Step 1 Build chains and times 25% Stop.

Initial state 100% Stop. Light. dll Step 1 Build chains and times 25% Stop. Light. UI. dll 50% 100% Stop. Light. Logic. dll 75% Stop. Light. Interfaces. dll Stop. Light. Services. dll Step 2 25% Stop. Light. UI. dll 0% Stop. Light. dll 25% Stop. Light. Logic. dll 25% Stop. Light. Services. dll 100% Stop. Light. Interfaces. dll

DI Frameworks https: //www. youtube. com/watch? v=h. BVJbz. Aagfs

DI Frameworks https: //www. youtube. com/watch? v=h. BVJbz. Aagfs