SLIDE 1 Managing Modular Software
for your NuGet, C++ and Java Development
SLIDE 2 Agenda
- Modular software – why?
- Building modular software…
- … in Java
- … in C++
- … in .NET
SLIDE 3 Who’s talking?
3
@jbaruch
SLIDE 4
WTF IS MODULE?
SLIDE 5 Module
Modular programming (also called "top- down design" and "stepwise refinement") is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
SLIDE 6
TL;DR
SLIDE 7
Module
SLIDE 8
Module Formula
Data + Metadata = Module
SLIDE 9
Unit of code
SLIDE 10
Encapsulated
SLIDE 11
Encapsulated
SLIDE 12
Discrete
SLIDE 13
Discrete
SLIDE 14
Discrete
SLIDE 15
Reusable
SLIDE 16
Exposed via APIs
SLIDE 17
Packages
SLIDE 18
SLIDE 19 Modules or Packages?
Technology ¡ Package ¡ Module ¡
SLIDE 20 Modules or Packages?
Technology ¡ Package ¡ Module ¡ Java ¡ package ¡keyword ¡seman2cs ¡ *.jar ¡files, ¡OSGi ¡bundles ¡
SLIDE 21 Modules or Packages?
Technology ¡ Package ¡ Module ¡ Java ¡ package ¡keyword ¡seman2cs ¡ *.jar ¡files, ¡OSGi ¡bundles ¡ C++ ¡ namespace ¡keyword ¡seman2cs ¡ *.dll ¡files, ¡*.so ¡files ¡
SLIDE 22 Modules or Packages?
Technology ¡ Package ¡ Module ¡ Java ¡ package ¡keyword ¡seman2cs ¡ *.jar ¡files, ¡OSGi ¡bundles ¡ C++ ¡ namespace ¡keyword ¡seman2cs ¡ *.dll ¡files, ¡*.so ¡files ¡ C# ¡ namespace ¡keyword ¡seman2cs ¡ *.dll ¡files, ¡NuGet ¡packages ¡
SLIDE 23
Modular Software – why?
SLIDE 24
Discrete Units Are Smaller
SLIDE 25
Modular Security Control
SLIDE 26
Multi-Team Agility
SLIDE 27
Code Sharing
SLIDE 28
Forcing API
SLIDE 29
Module ð Dependency
SLIDE 30
HOW STUFF PLAYS WITH MODULES
SLIDE 31
Build Tools and Dependencies
SLIDE 34 Recipe
- 1. Take sources – OK
- 2. Bring dependencies
SLIDE 35 Recipe
- 1. Take sources – OK
- 2. Bring dependencies – where from?
SLIDE 36 Recipe
- 1. Take sources – OK
- 2. Bring dependencies – where from?
- 3. Build binaries
SLIDE 37 Recipe
- 1. Take sources – OK
- 2. Bring dependencies – where from?
- 3. Build binaries – OK
SLIDE 38 Recipe
- 1. Take sources – OK
- 2. Bring dependencies – where from?
- 3. Build binaries – OK
- 4. …
SLIDE 39 Recipe
- 1. Take sources – OK
- 2. Bring dependencies – where from?
- 3. Build binaries – OK
- 4. … - now what?
SLIDE 40
CI Servers and Modules
SLIDE 41
CI servers run build tools.
SLIDE 42
CI servers run build tools.
SLIDE 43
We can do better!
SLIDE 44
Cascading Builds
SLIDE 45
Per module results
SLIDE 46
Wait, while on the CI Servers…
SLIDE 47
BINARY REPOSITORY AND…
SLIDE 48
What is Binary Repository
SLIDE 49
Said who?
SLIDE 50
Binary Repository Experts
SLIDE 51
Binary Repository as Modules Source
SLIDE 52
Binary Repository as Modules Source
SLIDE 53
Binary Repository as Modules Source
SLIDE 54
Binary Repository as Deployment Target
SLIDE 55
Binary Repository as Deployment Target
SLIDE 56
Wait a Minute, What’s Wrong With My Source Control System?!
SLIDE 57
SLIDE 58
Sources vs. Binaries
Sources ¡ Binaries ¡
SLIDE 59
Sources vs. Binaries
Sources ¡ Binaries ¡ Text ¡ Blob ¡
SLIDE 60
Sources vs. Binaries
Sources ¡ Binaries ¡ Text ¡ Blob ¡ Diffable ¡ Not ¡diffable ¡
SLIDE 61
Sources vs. Binaries
Sources ¡ Binaries ¡ Text ¡ Blob ¡ Diffable ¡ Not ¡diffable ¡ Versioned ¡by ¡ content ¡ Versioned ¡by ¡ name ¡
SLIDE 62 Sources vs. Binaries
Sources ¡ Binaries ¡ Text ¡ Blob ¡ Diffable ¡ Not ¡diffable ¡ Versioned ¡by ¡ content ¡ Versioned ¡by ¡ name ¡ Stored ¡by ¡
Should ¡never ¡
SLIDE 63 Versioning By Content
¡ Text ¡ MyPoem.txt ¡ (rev. ¡01) ¡
SLIDE 64 Versioning By Content
Text ¡ More ¡ Text ¡ MyPoem.txt ¡ (rev. ¡02) ¡
SLIDE 65 Versioning By Content
Text ¡ More ¡ Text ¡ More ¡ Text ¡ MyPoem.txt ¡ (rev. ¡03) ¡
SLIDE 66 Versioning By Content
Text ¡ More ¡ Text ¡ More ¡ MyPoem.txt ¡ (HEAD) ¡
SLIDE 67 Mismatch
Text ¡ More ¡ Text ¡ More ¡ Text ¡ MyPoem.txt ¡ 0100110 1010011 0110101 ¡ 0100110 1001101 1011010 ¡ 1010011 1010011 0110101 ¡ MyBook-‑1.0.zip ¡ MyBook-‑1.1.zip ¡ MyBook-‑2.0.zip ¡
SLIDE 68
SLIDE 69
SLIDE 70
SLIDE 71
SLIDE 72
Git is a Distributed System
SLIDE 73
R U SURE U WANT 2 CLONE IT ALL?
SLIDE 74
OK Then, But What’s Wrong With My File Server?!
SLIDE 75
It’s Fine if it knows how to:
SLIDE 76 It’s Fine if it knows how to:
Optimize storage size
SLIDE 77 It’s Fine if it knows how to:
Optimize storage size
SLIDE 78 It’s Fine if it knows how to:
Optimize storage size Expose REST API
SLIDE 79 It’s Fine if it knows how to:
Optimize storage size Enforce Module Security Expose REST API
SLIDE 80 It’s Fine if it knows how to:
M a n a g e a r t i f a c t l i f e c y c l e Optimize storage size Enforce Module Security Expose REST API
SLIDE 81 It’s Fine if it knows how to:
M a n a g e a r t i f a c t l i f e c y c l e Optimize storage size Enforce Module Security Expose REST API
SLIDE 82 It’s Fine if it knows how to:
M a n a g e a r t i f a c t l i f e c y c l e Optimize storage size Enforce Module Security Expose REST API Search by name, context and content
SLIDE 83
BTW, How Many Years It Took?
SLIDE 84
Binary Repository and CI/CD
SLIDE 85
CI Server is the Single Source of Truth
SLIDE 86
Binary Repository is The Single Target of Truth
SLIDE 87
Save the Truth!
SLIDE 88
Make Strange Binary Love
SLIDE 89
Standard of Truth
SLIDE 90
How Everything Fits Together
SLIDE 91
How Everything Fits Together
SLIDE 92
How Everything Fits Together
SLIDE 93
How Everything Fits Together
SLIDE 94
How Everything Fits Together
SLIDE 95
How Everything Fits Together
SLIDE 96
How Everything Fits Together
SLIDE 97
Perfect…
SLIDE 98
You Liked it, didn’t you?
SLIDE 99
Things to Consider
SLIDE 100
Lock-in?
SLIDE 101
Technology Specific?
SLIDE 102 Features to Look For
ü Not only Maven ü Not only Java ü Broad CI tools matrix
ü Build tools ü CI Servers
ü Extensive REST support ü Easy to extend
M
t b
i n g s l i d e s
a r …
SLIDE 103
MODULES IN… JAVA
SLIDE 104
Java package
SLIDE 105
Fragmentation
SLIDE 106 The options are:
- OSGi
- Jigsaw
- Build systems managed
– Maven, Gradle, Ivy
B u l l e t s ? R e a l l y ?
SLIDE 107
SLIDE 108
SLIDE 109
SLIDE 110
SLIDE 111
SLIDE 112
SLIDE 113
SLIDE 114 Project Jigsaw
First promise: Java 7 (2008) Current promise: Java 9 (2015)
SLIDE 115 Project Jigsaw
First promise: Java 7 (2008) Current promise: Java 9 (2015)
SLIDE 116
Back to plain old
SLIDE 117
Modular Build in Java
SLIDE 118
Modular Build in Java
SLIDE 119
Modular Build in Java
SLIDE 120
Modular Build in Java
SLIDE 121
Modular Build in Java
SLIDE 122
Modular Build in Java
SLIDE 123
Modular Build in Java
SLIDE 124
Modular Build in Java
SLIDE 125
Modular Build in Java
SLIDE 126
Modular Build in Java
SLIDE 127
MODULES IN… C++
SLIDE 128
SLIDE 129
SLIDE 130
SLIDE 131
SLIDE 132
Module Binaries Library ¡ OS ¡ File ¡type ¡ Sta2c ¡ Win ¡ *.lib ¡ *nix ¡ *.a ¡ Dynamic ¡ Win ¡ *.dll ¡ *nix ¡ *.so ¡
SLIDE 133
Managing Dependencies in C++
SLIDE 134
Managing Dependencies in C++
SLIDE 135
Make?
SLIDE 136
Make?
SLIDE 137
Make?
SLIDE 138
CMake?
SLIDE 139
Java-Like (and Java) tools?
SLIDE 140
Groovy tool!
SLIDE 141
Modular Build in C++
SLIDE 142
Modular Build in C++
SLIDE 143
Modular Build in C++
SLIDE 144
Modular Build in C++
SLIDE 145
Modular Build in C++
SLIDE 146
Modular Build in C++
SLIDE 147
MODULES IN… .NET
SLIDE 148
From C++ to C# Library ¡ OS ¡ File ¡type ¡ Sta2c ¡ Win ¡ *.lib ¡ *nix ¡ *.a ¡ Dynamic ¡ Win ¡ *.dll ¡ *nix ¡ *.so ¡
SLIDE 149
From C++ to C# Library ¡ Win ¡ File ¡type ¡ Sta2c ¡ Win ¡ *.lib ¡ Dynamic ¡ Win ¡ *.dll ¡
SLIDE 150
Library ¡ Win ¡ File ¡type ¡ Sta2c ¡ Win ¡ *.lib ¡ Dynamic ¡ Win ¡ *.dll ¡ But is it the Only Change?
SLIDE 151
, Baby!
SLIDE 152
Modular Build in .NET
SLIDE 153
Modular Build in .NET
+ ¡
SLIDE 154
Modular Build in .NET
+ ¡
SLIDE 155
Modular Build in .NET
+ ¡
SLIDE 156
DEMO TIME!
SLIDE 157
The Common Factor
+ ¡
SLIDE 158