Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Domain Driven Design for Finance & Cashflow Mod...

Domain Driven Design for Finance & Cashflow Modeling

These are the supporting slides for a hands-on given at DDD EU 2020, focused on exploring the accounting and cashflow domains. Participants were given the task to understand the building blocks of a cashflow forecast app, using DDD principles.

François Royer

February 07, 2020
Tweet

More Decks by François Royer

Other Decks in Programming

Transcript

  1. DDD for finance & cashflow modeling Applying DDD techniques to

    better understand cashflow forecasting © GuanxiLabs 2019 $ € £ € € £ £ € $ $
  2. How this hands-on is organised • The story – why

    cashflow forecasting and for who? • Accouting 101 for hackers and computer scientists 1 2 3 • Brainstorming exercise: identify the building blocks of a cashflow forecast app • Review of the outcome – a mapping between DDD concepts and accounting objects • Prototyping using a spreadsheet • Review of the outcome and what needs to be added for a fully functional app
  3. The story – choose your persona SOFTWARE ENGINEER TURNED ENTREPRENEUR

    BUSINESS ANALYST or « What is the company’s available cash flow for the upcoming year? »
  4. The accounting cycle time Beginning of fiscal year End of

    fiscal year Opening Closing Recording & bookkeeping
  5. Core principles, such as double-entry accounting and financial aggregates seem

    very DDD friendly ENTERPRISE ASSETS CASH 10 000€ flow in « My company buys 10 000 € of goods in cash (paid immediately) » 10 000€ flow out
  6. Core principles, such as double-entry accounting and financial aggregates seem

    very DDD friendly ENTERPRISE CASH INCOME 10 000€ flow in « My company sells 5 000 € of services (paid immediately) » 10 000€ flow out
  7. Bookeeping involves identifying what economic aggregates are concerned by documents

    (e.g. invoices) ECONOMIC AGGREGATES ASSETS LIABILITIES CASH EXPENDITURES INCOME
  8. Bookeeping involves identifying what economic aggregates are concerned by documents

    (e.g. invoices) TRANSACTION ACTIVITIES ASSETS ACCOUNT IN (debit) OUT (credit) IN (debit) OUT (credit) TOTAL What economic aggregates are involved What accounts are subject to the transactions
  9. Bookeeping involves identifying what economic aggregates are concerned by documents

    (e.g. invoices) TRANSACTION ACTIVITIES ASSETS ACCOUNT IN (debit) OUT (credit) IN (debit) OUT (credit) TOTAL What economic aggregates are involved What accounts are subject to the transactions Expenditure In Liability Out 5000 5000 601 – raw goods 401 - Suppliers Liability In Cash Out 5000 5000 401 – Suppliers 512 - Bank 20/02/N 30/04/N
  10. Trees are already part of the accounting domain language Suppliers

    Third party accounts Customers Social State Group & shareholders VAT CSG, family… Accounts payable Accounts receivable
  11. Cashflow forecasting is part of the CFO’s activities… not the

    accountant’s To negotiate financial products with the banker To repay debt To plan for investments and new hires To pay yourself or your shareholder dividends To value a business (DCF)
  12. To computer scientists, business is just another graph Bank account

    23995 € https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html Furniture 375 € 500 € Founders -25000 € Credit card -8 € Food 13 € 5 € 13 € 5000 € Sales -10000 € Customer 2 2500 € Customer 2 0 € 5000 € 5000 € 5000 € 2500 € Payroll 8000 € 8000 € Depreciation 125 € 125 €
  13. Assets/liabilities, income/expenditure and capital are just another view Bank account

    23995 € https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html Furniture 375 € 500 € Founders -25000 € Credit card -8 € Food 13 € 5 € 13 € 5000 € Sales -10000 € Customer 2 2500 € Customer 2 0 € 5000 € 5000 € 5000 € 2500 € Payroll 8000 € 8000 € Depreciation 125 € 125 €
  14. The Direct vs the Indirect Approach to cashflow forecast Some

    handler Entity 1 Agg root Entity 2 Projection at T+1, T+N… of aggregates Impact on cash balance Invoice 2020-1 Invoice 2020-12 … At some time
  15. Warm-up exercise – applying DDD to VAT payments VAT State

    Invoice 2020-1 Invoice 2020-2 Invoice 2020-12 … Invoice 2020-1 Invoice 2020-2 Invoice 2020-12 … VAT handler Passage of time ? What happens here?
  16. Modeling time! • The story – why cashflow forecasting and

    for who? • Accouting 101 for hackers and computer scientists 1 2 3 • Brainstorming exercise: identify the building blocks of a cashflow forecast app • Review of the outcome – a mapping between DDD concepts and accounting objects • Prototyping using a spreadsheet • Review of the outcome and what needs to be added for a fully functional app