Skip to content

Instantly share code, notes, and snippets.

View simonbrowndotje's full-sized avatar

Simon Brown simonbrowndotje

View GitHub Profile
@simonbrowndotje
simonbrowndotje / PrintDiamond.java
Last active December 24, 2015 01:48
Our first solution to the "Print Diamond" kata at the first Tech Tribes Jersey Coding Dojo (http://www.techtribes.je/events/50), by Simon Brown and Jason Roberts ... it could do with some further refactoring, validation, etc but it basically works.
public class PrintDiamond {
public static void main(String[] args) {
char letter = args[0].toUpperCase().charAt(0);
int letterAsNumber = ((int)letter - (int)'A') + 1;
int gridSize = (letterAsNumber * 2) - 1;
int numberOfSpacesAtEdge = (gridSize - 1) / 2;
int numberOfSpacesInMiddle = 0;
Simon lives in Jersey (the largest of the Channel Islands) and works as an independent consultant, helping teams to build better software. His client list spans over 20 countries and includes organisations ranging from small technology startups through to global household names. Simon is an <a href="http://www.codingthearchitecture.com/2013/05/17/saturn_2013.html" target="_blank">award-winning speaker</a> and the author of <a href="http://leanpub.com/software-architecture-for-developers" target="_blank">Software Architecture for Developers</a> - a developer-friendly guide to software architecture, technical leadership and the balance with agility. He still codes too.
{
"people" : [ {
"id" : 3,
"name" : "Authenticated User",
"description" : "A user or business who's content is aggregated into the website.",
"location" : "Internal",
"relationships" : [ {
"sourceId" : 3,
"destinationId" : 8,
"description" : "Manage user profile and tribe membership."
Model model = new Model();
SoftwareSystem techTribes = model.addSoftwareSystem(Location.Internal, "techtribes.je", "techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands");
Person anonymousUser = model.addPerson(Location.External, "Anonymous User", "Anybody on the web.");
Person aggregatedUser = model.addPerson(Location.External, "Aggregated User", "A user or business with content that is aggregated into the website.");
Person adminUser = model.addPerson(Location.External, "Administration User", "A system administration user.");
anonymousUser.uses(techTribes, "View people, tribes (businesses, communities and interest groups), content, events, jobs, etc from the local tech, digital and IT sector.");
aggregatedUser.uses(techTribes, "Manage user profile and tribe membership.");
package je.techtribes.component.tweet;
import com.structurizr.annotation.Component;
...
@Component(description = "Provides access to tweets.")
public interface TweetComponent {
/**
* Gets the most recent tweets by page number.
Model model = ...
SoftwareSystem techTribes = model.getSoftwareSystemWithName("techtribes.je");
Container contentUpdater = techTribes.getContainerWithName("Content Updater");
// context view
ContextView contextView = model.createContextView(techTribes);
contextView.addAllSoftwareSystems();
contextView.addAllPeople();
// container view
{
"people" : [ {
"id" : 3,
"name" : "Aggregated User",
"description" : "A user or business with content that is aggregated into the website.",
"location" : "External",
"relationships" : [ {
"sourceId" : 3,
"destinationId" : 1,
"description" : "Manage user profile and tribe membership."
@simonbrowndotje
simonbrowndotje / FinancialRiskSystem.java
Last active August 29, 2015 14:03
This is a simple (incomplete) example C4 model based upon the financial risk system architecture kata, which can be found at http://bit.ly/sa4d-risksystem
package com.structurizr.example;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.structurizr.model.Location;
import com.structurizr.model.Model;
import com.structurizr.model.Person;
import com.structurizr.model.SoftwareSystem;
import com.structurizr.view.ContextView;
@simonbrowndotje
simonbrowndotje / SpringPetClinic.java
Last active August 29, 2015 14:03
This is a C4 representation of the Spring PetClinic sample app (https://github.com/spring-projects/spring-petclinic/).
package com.structurizr.example;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.structurizr.componentfinder.ComponentFinder;
import com.structurizr.componentfinder.SpringComponentFinderStrategy;
import com.structurizr.model.*;
import com.structurizr.view.ComponentView;
import com.structurizr.view.ContainerView;
import com.structurizr.view.ContextView;
@simonbrowndotje
simonbrowndotje / spring-petclinic.json
Last active August 29, 2015 14:03
The JSON representation of the C4 model for the Spring PetClinic application
{
"people" : [ {
"id" : 2,
"name" : "User",
"description" : "",
"location" : "External",
"relationships" : [ {
"sourceId" : 2,
"destinationId" : 1,
"description" : "Uses"