Sacrificial Architecture

Ego Slide

f.strazzullo@ideato.it

@TheStrazz86

https://github.com/francesco-strazzullo

https://medium.com/@TheStrazz86

https://slides.com/francescostrazzullo

What was your "WOW effect" of Agile?

Welcome changing requirements, even late in
development

Welcome changing requirements, even late in
development

Welcome changing requirements, even late in
development

Let's talk about Software Architecture...

Try To Change This

Emergent Design

...architectures should be driven by the underlying technical requirements of the system, rather than speculative planning for a future that may change.

Thoughtworks Technology Radar

The right architecture should be defined by your features...

Try To Avoid This

Introducing

Sacrificial Architecture

Essentially it means accepting now that in a few years time you'll (hopefully) need to throw away what you're currently building.

Martin Fowler

Design code that you can throw away!

It's not a pattern, but a mindset

It's a great way to Test new features

You can easily kill a feature that you don't need anymore.

Sacrificial Architecture in modern web development

Modularity

duplication is far cheaper than the wrong abstraction

Sandi Metz

Web Components

Micro Frontends

(Maybe next time)

Separate Logic

export default (param) => {
    console.log(param);
};
import logger from './logger';

class DummyButton extends React.Component {
  render() {
    return (
      <div onClick={() => {logger('This is a Value!'}}>
        Click Me Bro!
      </div>
    );
  }
}
import EventBus from 'EventBus';

class DummyButton extends React.Component {
  onButtonClick() {
    EventBus.dispatch('SOMETHING_HAPPENED','This is a Value!');
  }
  
  render() {
    return (
      <div onClick={() => {onButtonClick()}}>
        Click Me Bro!
      </div>
    );
  }
}
import EventBus from 'EventBus';

export default {
    init:{
        EventBus.on('SOMETHING_HAPPENED',(param) => {
            console.log(param);
        });        
    }
};

Frameworks

Why it's so hard to change a framework?

Inappropriate coupling

app.factory('getUsers',['$http',function($http){
    return $http.get('api/v1/users');
});
app.controller('home',[
    '$scope',
    'getUsers',
    function(
        $scope,
        getUsers){
            getUsers().then(function(response){
                $scope.users = response.data;
            });
}]);
export default () => {
    return fetch('api/v1/users').then(function (response) {
        return response.json();
    });
};
import getUsers from './getUsers';

app.controller('home',[
    '$scope',
    function(
        $scope){
            getUsers().then(function(users){
                $scope.users = users;
            });
}]);

Design your way out of a framework

What I learned

To throw away is not waste

Go with the flow

Martin Fowler

Sacrificial Architecture, sometimes it’s the fastest way to learn things

Thanks!