Commit f0e0169f authored by Gerson Sunyé's avatar Gerson Sunyé
Browse files

several small typos

parent 0c1dcc88
Pipeline #14565 passed with stages
in 2 minutes and 45 seconds
......@@ -292,7 +292,7 @@ post:
image::library-interface.png[align=center]
[.col-8]
* Operation `Library::borrow(bookId:Integer, memeberId:Integer):Boolean`
* Operation `Library::borrow(bookId:Integer, memberId:Integer):Boolean`
* *post-conditions*:
** the book is unavailable
** the member has the book in his borrowed books.
......@@ -303,7 +303,7 @@ image::library-interface.png[align=center]
[source,ocl]
----
context Library::borrow(bookId:Integer, memeberId:Integer):Boolean
context Library::borrow(bookId:Integer, memberId:Integer):Boolean
post:
let book = self.books[bookId] in
let member = self.members[memberId] in
......@@ -316,7 +316,7 @@ post:
-- the library keeps a trace of the borrowing.
self.borrowings->select(each | each.member = member and
each.book = book)->exists(each | each.oclIsNew())
each.book = book)->exists(each | each.oclIsNew())
----
== Implementing pre- and post-conditions
......@@ -379,11 +379,9 @@ public void returnBook(Integer bookId) {
image::open-parenthesis.png[align=center]
== UML Activitiy Diagram
== UML Activity Diagram
image::uml-activities.png[align=center]
—-
image::uml-activities.png[align=center,height=800px]
== Parameters, pre- and post-conditions
......
= Apache Maven
== Foreword
«Maven was born of the practical desire to make several projects at the Apache Software Foundation(ASF) work in the same, predictable way.
Before, every project at the ASF had a different approach to compilation, distribution, and web site generation. Ex. Build process for Tomcat was different from build process used by Struts. Turbine developers used a different approach to site generation than the developers of Jakarta, Commons, etc. (…)»
'''
« (…) This lack of common approach to building software meant that every new project tended to copy and paste another project’s build system.
The barrier to entry for a project with a difficult build system was extremely high. Difficult to attract developer because it could take an hour to configure everything in just the right way.»
http://maven.apache.org
'''
== Maven is
* A project management framework.
* A build tool.
* A set of standards.
* An artifact repository.
* An standard build life cycle.
'''
== Principles
«Convention over configuration»
«Reuse of build logic»
'''
== Conventions
* Standard directory layout: sources, resources, config files, generated output, documentation, web site, etc.
* A single Maven project produces a single output.
* Standard naming conventions.
'''
== Features
* A comprehensive software project model (POM) and tools that interact with this declarative model.
* Allows developers to declare goals and dependencies and rely on default structure and plugin capabilities.
'''
== Benefits
* Coherence: Maven allows organizations to standardize on a set of best practices.
* Reusability (reusing the best practices).
'''
== Benefits
* Agility: lowers the barrier to reuse not only of build logic but of components. It is easier to create a component and integrate it to a multi-project build. Easier for developers to jump between projects without the a steep learning curve.
* Maintainability: stop building the build and focus on the application.
'''
== The Project Object Model
[source,xml]
----
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>javaero</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Javaero</name>
<url>http://maven.apache.org</url>
<description></description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
----
* This pom will allow you to compile, test and generate basic documentation.
'''
== Build lifecycle
* A series of phases where each phase can perform one or more actions, or goals, related to that phase.
* For instance, the compile phase invokes a certain set of goals to compile set of classes.
'''
== Build lifecycle
* If you tell Maven to compile, the validate, initialize, generate-sources, process-sources, generate-resources, and compile phases will execute.
'''
== Build lifecycle
* Standard build life cycle consists of many phases and these can be thought of as extension points.
* When you need to add some functionality to the build lifecycle you do so with the plugin.
'''
== Build lifecycle
* Maven Plugins provide reusable build logic that can be slotted into the standard build life cycle.
* Any time you need to to customize the way your projects builds you either employ the use of an existing plugin or create custom plugin for the task at hand.
'''
== Default build lifecycle
image:resources/png/build-lifecycle.png[]
'''
== Default build lifecycle (simplified)
. *validate* - validate the project is correct and all necessary information is available
. *compile* - compile the source code of the project
. *test* - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed.
. *package* - take the compiled code and package it in its distributable format, such as a JAR.
'''
. *integration-test* - process and deploy the package if necessary into an environment where integration tests can be run
. *verify* - run any checks to verify the package is valid and meets quality criteria
. *install* - install the package into the local repository, for use as a dependency in other projects locally
. *deploy* - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
'''
== Dependencies
* A dependency is a reference to a specific artifact that resides in a repository.
* In order for Maven to attempt to satisfy a dependency, Maven needs to know what the repository to look in as well as the dependency’s coordinates.
* A dependency is uniquely identified by the following identifiers: groupId, artifactId and version.
'''
== Dependencies are declaratives
* In the POM you are not telling Maven where the dependencies physically, you are simply telling Maven what a specific project expects.
'''
== Dependencies
* When a dependency is declared, Maven tries to satisfy that dependency by looking in all of the remote repositories that are available, within the context of your project, for artifacts that match the dependency request.
* If matching artifact is located, it transports it from remote repository to your local for general use.
'''
== Dependency Declaration
[source,xml]
----
<project>
:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
:
</project>
----
'''
== Repositories
* Types of repositories:
. Local: `~/.m2/repository`
** you must have a local repository in order for Maven to work.
. Remote
image:resources/jpg/repository.jpg[]
'''
=== General pattern for the repository layout
image:resources/jpg/repository-pattern.jpg[]
If the groupId is a fully qualified domain name such as `z.y.x` then you would end up with a directory structure like the following:
image:resources/jpg/directory-pattern.jpg[]
'''
== Locating Dependency Artifacts
. Maven will attempt to find the artifact with `groupId`, `artifactId` and `version` in local repository -&gt; `~/.m2/repository/…`
. If this file is not present, it will be fetched from remote repository.
. By default, Maven will fetch an artifact from the central Maven repository at https://repo.maven.apache.org/
. If your project’s POM contains more than one remote repository, Maven will attempt to download an artifact from each repository in the order defined in your POM.
. Once dependency is satisfied, the artifact is downloaded and installed in your local repository.
'''
== Getting Started with Maven
'''
== Preparing to use Maven:
. Download Maven from http://maven.apache.org and unzip it to your desired installation directory. Ex. C:\maven in Windows, or /usr/local/maven in Linux.
. Add System variable M2_HOME as well as $M2_HOME/bin directory to your system path.
. Type the following in a terminal or command prompt:
[source,sh]
----
mvn --version
----
'''
. If you are behind a firewall, create a `&lt;your-home-directory&gt;/.m2/setting.xml` with the following content:
[source,xml]
----
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.ensinfo.sciences.univ-nantes.prive</host>
<port>3128</port>
</proxy>
</proxies>
</settings>
----
'''
. If there is an active Internal Maven proxy running. create a <your-home-directory>/.m2/setting.xml with the following content:
[source,xml]
----
<settings>
<mirrors>
<mirror>
<id>maven.mycompany.com</id>
<name>University's Maven Proxy</name>
<url><http://maven.mycompany.com/maven3</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
----
—-
== Creating your First Maven Project
* To create the Quick Start Maven project, execute the following:
[source,sh]
----
mvn archetype:generate -DgroupId=fr.unantes.datatypes
-DartifactId=units
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
----
'''
* New directory `units` has been created for the new project, and this directory contains your `pom.xml` which looks like the following file:
[source,xml]
----
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.unantes.datatypes</groupId>
<artifactId>units</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>units</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
----
'''
* Directory structure of your project after archetype generation:
image:resources/png/units.png[]
'''
== Maven Basic Commands
* Compile the project: `mvn compile`
* The output were placed in target/classes
* Compile rests and sources and run unit tests: `mvn test`
* Compile your test (but not execute them): `mvn test-compile`
* Make a JAR file or the package: `mvn package`
* take a look at the target directory and you will see the generated JAR file.
* Install the artifact(JAR file) you’ve generated into your local repository so that it can be used by other projects. `&lt;your-home-directory&gt;/.m2/repository`is the default location: `mvn install`
'''
== Test Execution
* Surefire plugin (which executes the test) looks for tests contained in files with a particular naming convention. By default the following tests are included:
* `**/*Test.java`
* `**/***/Test*.java`
* `**/*TestCase.java`
* Conversely, the following tests are excluded:
* `**/Abstract*Test.java`
* `**/Abstract*TestCase.java`
—-
== Website/Reports Generation
* Generate a basic website for the project:
* `mvn site`
* Clean the project (remove the `target` directory):
* `mvn clean`
* Create descriptor for the projects
* for IntelliJ IDEA:
** `mvn idea:idea`
* for eclipse:
** `mvn eclipse:eclipse`
'''
== Summary
* Maven is a set of standards, a repository, a framework and is a software.
* Maven is more than just downloading another JAR and a set of scripts, it is the adoption of processes that allow you to take your software to the next level.
'''
== References
* http://maven.apache.org
* «Intro to Maven 2.0». Powerpoint presentation. Available at http://javaero.org
:revealjs_center: false
:revealjs_display: flex
:revealjs_transition: none
:revealjs_slideNumber: c/t
:revealjs_theme: stereopticon
:revealjs_width: 1920
:revealjs_height: 1080
:revealjs_history: true
:revealjs_margin: 0
:source-highlighter: highlightjs
:imagesdir: images
:includedir: includes
:sectids!:
= Continuous Integration
== Plan
* *Introduction*
* Control Version Systems
* Test Automatization
* Build Automation
* Feedback Mechanisms
* Continuous Deployment
* Conclusion
[.impact]
== Introduction
== Continuous Integration
[quote, Martin Fowler]
____
Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day.
Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.
____
== In other words
* Software integration is often perceived as a complex and annoying task.
* Continuous integration simplifies this task, making it part of developers daily work.
== A simple technique
.A simple yet powerful technique allowing software development teams to:
* keep team members in harmony.
* reduce potential drift hazard.
* limit complexity
[%notitle]
== A simple technique
* Regular build and test of the latest version of the software under development.
* Local testing and propagation to a single storage location of each developer's work.
== Motivation (1/3)
.Time saving:
* no more repetitive tasks.
* reduced need for documentation.
* better integration of newcomers, which can analyze and use build scripts directly.
.Developers' confidence improvement:
* Independent from the momentary/punctual efficiency of the developers.
* Use of reproducible procedures.
== Motivation (2/3)
.Risk reduction:
* errors are detected and fixed very early.
* software quality this measurable over time.
* reduction of assumptions.
.Manual task reduction:
* the build process is invariable: it follows the same sequence of tasks.
* the process runs automatically after each change/commit.
== Motivation (3/3)
* Availability of ready-to-use software at any time and place.
* Project visibility improvement:
** effective decisions.
** observable evolutions.
* Establish greater confidence in the software product from the development team
[.notes]
--
One of the most significant problems in software development is assuming
CI help to mitigate
- Lack of cohesive, deployable software
- Lack defect discovery
- Low-quality software
- Lack of project visibility
This facilitates
The reduction of labor on repetitive process
The capability to overcome resistance to implement improvements by using auto mated mechanisms for important processes
--
== Continuous Integration Components
* Control Version System (Repository)
* CI Server
* Build Scripts
* Feedback Mechanisms
* Integration
* Build Machine
[%notitle]
== Continuous Integration Components
.Continuous Integration Components
image::ci-components.png[align=center]
== Plan
* Introduction
* *Control Version Systems*
* Test Automatization
* Build Automation
* Feedback Mechanisms
* Continuous Deployment
* Conclusion
== Control Version System
* Unique place of sharing.
* Regression, snapshots, branches, etc.
* Tools: Git, Mercurial, Subversion, etc.
image::branch-and-merge.png[align=center]
== Plan
* Introduction
* Control Version Systems
* *Test Automatization*
* Build Automation
* Feedback Mechanisms
* Continuous Deployment
* Conclusion
== Test Automatization
[.columns]
--
[.col-4]
****
image::junit.png[align=center]
image::selenium.jpg[align=center]
****
[.col-8]
****
.Developers:
* participate in the creation of the tests
* validate their code locally.
.Tools
* JUnit, Selenium, SonarQube, PMD, FindBugs, etc.
****
--
== Unit Test Automatization
* Unit test verify the behavior of small elements in software system
* Mocks are simple object that substitute for real, more complicated object
* The key aspect for unit test is having no reliance on outside dependencies
== Integration Test Automatization
* Component or subsystem test verify portions of a system and may require a full installed system or same external dependencies
* Component level test use more dependencies than unit test but still not necessarily as many as high level system tests
== System Test Automatization
* System test exercise a complete software system and therefore require a full installed system
* System test are fundamentally different form functional test, system test much like a client would use the system
* Automate Functional tests
* Functional tests test the functionality of an application from the view point of a client, known as acceptance tests
== Continuous Test Evaluation
.Assess Code Coverage:
* Line coverage, statement coverage, indicates that a particular line of code was exercised
* Branch coverage measure the coverage of decision points
* Test run slower than they do in no coverage scenarios; It may be appropriate to run code coverage tools as part of a secondary, more heavyweight build
== Continuous Inspection
* Code Review can be impressively effective; however, they are run by humans, who tend to be emotional
* Pair Programming has also been shown to be effective when applied correctly
* Automated static code analysis scales more efficiently than humans for large code bases
* What is the different between inspection and testing
* Testing is dynamic and executes the software in order to test the functionality
* Inspection analyze the code based on a set of predefined rules
* Example of inspection targets include coding “grammar” standards, architectural layering adherence, code duplication, and so on
== Plan
* Introduction
* Control Version Systems
* Test Automatization
* *Build Automation*
* Feedback Mechanisms
* Continuous Deployment
* Conclusion
== Build Automatization
* Non-trivial Software is build using build management tools.
* The goal of a build management tool is to fully automate all steps required to build the product given the source artifacts of the project.
* The result of the build should always be the same - independently of the developer’s local configuration.
** Builds must be stable.
* The build management tool is responsible for automatically carrying out all steps necessary to build the product.
== Build Automatization Tools
* Client tools: scripts to compile, assemble, generate, deploy, etc.
* Schedulers: automation scripts in the server side (e.g. crontab).
* Examples: Ant, NAnt, Maven, Gradle, Rake, etc.
== Build Tools Functionalities
.A Build Automation typically executes the following tasks:
* Source Code Formatting
* Code generation
* Code compilation
* Component packaging
* Program execution
* File manipulation
[%notitle]
== Build Tools Functionalities
.Extended tasks:
* Development test execution
* Version control tool integration
* Generating and publishing documentation, release notes, web pages, etc.
* Deployment to the test system/production system(s)
* Code quality analysis
* Extensibility
* Multiplatform builds
* Accelerated builds
== Build Schedulers Functionalities
[.columns]
--