As modern, agile architects and developers we need to master several different languages and technologies all at once to build state-of-the-art solutions and yet be 100% productive. We define our development environments using Gradle. We implement our software in Java, Kotlin or another JVM based language. We use Groovy or Scala to test our code at different layers. We construct the build pipelines for our software using a Groovy DSL or JSON. We use YAML and Python to describe the infrastructure and the deployment for our applications. We document our architectures using AsciiDoc and JRuby. Welcome to Babel!
Making the right choices in the multitude of available languages and technologies is not easy. Randomly combining every hip technology out there will surely lead into chaos. What we need is a customized, streamlined tool chain and technology stack that fits the project, your team and the customer’s ecosystem all at once. This code intense, polyglot session is an opinionated journey into the modern era of software industrialization.
12. Definition of Software Industrialization
• This has nothing to do with cheap labor!
• Automation of repetitive and laborious tasks
• Better software quality through a standardized
and streamlined tool chain
• A well integrated tool chain leads to a higher
productivity and happiness of your team
• Better cost efficiency and competitiveness
14. val softwareIndustrialization = everythingAsCode()
open fun everythingAsCode() =
everythingIsMadeFromCode()
&& everythingIsMadeByCode()
private fun everythingIsMadeFromCode() = true
private fun everythingIsMadeByCode() = true
15. The Quest for an ideal project archetype
• Which languages are used for the specific
domains in our projects?
• Which tools are used for Setup, Build, Code,
Test, CI, Infrastructure, Documentation?
• What are the the dos and don'ts of using a
specific language or technology?
+ some Wishful Greenfield Thinking!
18. Lightweight Developer Provisioning
• [ SEU ] German acronym; Software Entwicklungs-Umgebung
• Use a build tool for the automated creation and update
of a software development environment
• Software packages are expressed as dependencies
• Gradle tasks and Groovy are used instead of shell
scripting
• The SEU definition is version controlled just like
ordinary source code
• Available open source at http://seu-as-code.io
19. plugins { id 'de.qaware.seu.as.code.base' version '2.4.0' }
import static de.qaware.seu.as.code.plugins.base.Platform.isMac
seuAsCode {
seuHome = { if (isMac()) '/Volumes/Everything-as-code' else 'Y:' }
projectName = 'Everything-as-code'
}
dependencies {
// list of software dependencies ...
software 'org.groovy-lang:groovy:2.4.7'
software 'org.scala-lang:scala:2.11.8'
software 'org.jruby:jruby:9.1.4.0'
}
25. But Kotlin is a serious
alternative worth considering
as primary language.
26. But why Kotlin? And not Scala, Clojure, et.al.
• Easy to learn for Java developers.
• Well-balanced universal language.
• Inbuilt Null safety & Syntactic sugar &
Excellent interoperability.
• JDK6 compatible. Small library size.
• Good IDE and tool support.
27. @JsonIgnoreProperties(ignoreUnknown = true)
data class Book(val title: String, val isbn: String, val author: String)
@ApplicationScoped
open class Bookshelf {
private val books = listOf(Book("The Hitchhiker's Guide to the Galaxy", "0345391802"))
open fun byIsbn(isbn: String): Book? = books.find { it.isbn == isbn }
}
@Path("books")
@Produces(MediaType.APPLICATION_JSON)
open class BookResource @Inject constructor(private val bookshelf: Bookshelf) {
@GET @Path("/{isbn}")
open fun byIsbn(@PathParam("isbn") isbn: String): Response {
val book = bookshelf.byIsbn(isbn)
return if (book != null) Response.ok(book).build() else Response.status(Status.NOT_FOUND).build()
}
}
@ApplicationPath("api")
class BookstoreAPI : Application() {
override fun getClasses() = hashSetOf(JacksonFeature::class.java, BookResource::class.java)
}
31. Groovy and Spock for Unit & Integration Tests
class BookshelfSpec extends Specification {
@Subject
def bookshelf = new Bookshelf()
@Unroll
def "Find book #title by ISBN #isbn"() {
when: 'we search a book by ISBN'
def book = bookshelf.byIsbn(isbn)
then: 'the title and author are correct'
book?.title == title
book?.author == author
where:
isbn || title | author
"0345391802" || "The Hitchhiker's Guide to the Galaxy" | "Douglas Adams"
"0345391829" || "Life, the Universe and Everything" | "Douglas Adams"
}
}
32. Scala and Gatling for Load Testing
class BooksPerformanceTest extends Simulation {
val conf = http.baseURL("http://localhost:18080").acceptHeader("application/json")
val feeder = csv("books.csv").random
val scn = scenario("Book Search")
.exec(http("Get all books").get("/api/books"))
.during(30 seconds) {
feed(feeder)
.exec(http("Get book by title ${Title}").get("/api/books?title=${Title}"))
.pause(1 second)
.exec(http("Get book with ISBN ${ISBN}").get("/api/books/${ISBN}"))
}
setUp(scn.inject(atOnceUsers(10), rampUsers(50) over (30 seconds)))
.assertions(global.responseTime.max.lessThan(5000))
.protocols(conf)
}
41. Yes, we need documentation!
• And no, the source code is not enough.
• Writing technical docs with Word is ! " #
• Documentation should be located next to the
source code: change code, change docs.
• It should be easy, quick and fun to write.
• Support for code, images, UML diagrams, ...
42. // Beispiel Architektur-Dokumentation mit arc42 (https://arc42.github.io)
:imagesdir: ./images
= image:qaware-logo.png[QAware GmbH,2016] Everything-as-code
:toc-title: Table of Contents
:toc:
[[section-introduction-and-goals]]
== Introduction and Goals
The introduction to the architecture documentation should list the driving forces
that software architects must consider in their decisions.
=== Requirements Overview
=== Quality Goals
=== Stakeholders
<<<<
include::02_architecture_constraints.adoc[]
// further includes for the remaining sections
43. AsciidoctorJ and Gradle to the Rescue
plugins { id "org.asciidoctor.convert" version "1.5.3" }
asciidoctorj { version = '1.5.4.1' }
asciidoctor {
sourceDir 'src/docs/architecture'
resources {
from('src/docs/architecture') {
include 'images/**/*.png'
include 'images/**/*.jpg'
}
}
backends 'html5'
options doctype: 'article'
attributes 'source-highlighter': 'coderay'
}
45. Architecture documentation using Structurizr
def workspace = new Workspace("Everything-as-code", "The system context of Everything-as-code.")
def model = workspace.model
// create a model and the software system we want to describe
def bookApp = model.addSoftwareSystem("Book Application", "The best source to get info on books.")
// create the various types of people (roles) that use the software system
def anonymousUser = model.addPerson("Anonymous User", "Anybody on the web.")
anonymousUser.uses(bookApp, "Searches for books and views details.")
def browser = bookApp.addContainer("Web Browser",
"Allows users to view information about books", "Edge, Chrome, Firefox")
anonymousUser.uses(browser, "Views information from and makes requests to")
def webApp = bookApp.addContainer("Web Application",
"Hosts the browser-based web application and services", "Payara Fish")
browser.uses(webApp, "uses [JSON/HTTPS]")
48. These slides were written in Markdown.
---
## [fit] These slides were written in Markdown.
- This is for real programmers! :smiley:
- Several open source projects available
- Use HTML and JavaScript alternatively.
---
49. State of the art
software projects
are polyglot.