|
1035 | 1035 | #####Manual DI - Wiring mess |
1036 | 1036 |
|
1037 | 1037 | ```cpp |
1038 | | -App::App(const TReader&, IPrinter&); |
| 1038 | +App::App(const Reader& reader, Printer& printer); |
1039 | 1039 | ``` |
1040 | 1040 |
|
1041 | 1041 | ```cpp |
1042 | 1042 | int main() { |
1043 | | - auto reader = MyReader{}; // WIRING! |
1044 | | - auto printer = ConsolePrinter{}; // WIRING! |
| 1043 | + auto reader = Reader{}; // WIRING! |
| 1044 | + auto printer = Printer{}; // WIRING! |
1045 | 1045 | auto app = App{reader, printer}; // WIRING! |
1046 | 1046 | app.run(); |
1047 | 1047 | } |
|
1258 | 1258 | | | | | |
1259 | 1259 | |-|-|-| |
1260 | 1260 | | TDD | Test Driven Development | Unit Tests | |
1261 | | -| BDD | Behaviour Test Driven Development | Unit/Integration Tests | |
| 1261 | +| BDD | Behaviour Test Driven Development | Integration/Acceptance Tests | |
1262 | 1262 |
|
1263 | 1263 | ---- |
1264 | 1264 |
|
|
1323 | 1323 | Then The 42 should be printed |
1324 | 1324 | ``` |
1325 | 1325 |
|
1326 | | - |
1327 | | -``` |
1328 | | -``` |
| 1326 | +`test/features/file_viewer` |
1329 | 1327 |
|
1330 | 1328 | ---- |
1331 | 1329 |
|
1332 | | -### BDD - Gherkin/Cucumber (Integration Testing) |
| 1330 | +### BDD - Gherkin/Cucumber (Acceptance Testing) |
1333 | 1331 |
|
1334 | 1332 | ```cpp |
1335 | 1333 | GIVEN("^I have a file with a (\\d+) in it$") { |
|
1362 | 1360 | } |
1363 | 1361 | ``` |
1364 | 1362 |
|
| 1363 | +`file_viewer.cpp` |
| 1364 | + |
1365 | 1365 | ---- |
1366 | 1366 |
|
1367 | | -## BDD - DI/Mocking (Unit Testing) |
| 1367 | +### BDD - Gherkin/Cucumber |
| 1368 | + |
| 1369 | +#### Run |
| 1370 | +```sh |
| 1371 | +./cucumber test/features/file_viewer |
| 1372 | +``` |
1368 | 1373 |
|
1369 | 1374 | ```cpp |
1370 | | -"[scenario] Value from a file is displayed"_test { |
1371 | | - auto [app, mocks] = testing::make<App>() |
| 1375 | +Feature: File Viewer |
1372 | 1376 |
|
1373 | | - GIVEN(mocks<Readable>(), read().WillOnce(Return(42)); |
| 1377 | +Scenario 1: Value from a file is displayed # test/.../file_viewer:12 |
| 1378 | + Given I have a file with a 42 value in it # file_viewer.cpp:22 |
| 1379 | + And the App is created # file_viewer.cpp:33 |
| 1380 | + When The App runs # file_viewer.cpp:34 |
| 1381 | + Then The 42 should be printed # file_viewer.cpp:48 |
1374 | 1382 |
|
1375 | | - WHEN(app.run()); |
| 1383 | +``` |
1376 | 1384 |
|
1377 | | - THEN(mocks<Printable>(), print(42)); |
1378 | | -} |
| 1385 | +#### Output |
| 1386 | +```cpp |
| 1387 | +1 scenario (1 passed) |
| 1388 | +4 steps (4 passed) |
| 1389 | +0m0.015s |
1379 | 1390 | ``` |
1380 | 1391 |
|
1381 | 1392 | ---- |
|
1462 | 1473 |
|
1463 | 1474 | <img style="background:none; border:none; box-shadow:none;" src="images/ts_cd.png" width="75%" /> |
1464 | 1475 |
|
1465 | | -#### Loosely coupled components (it's not a class diagram) |
| 1476 | +#### Loosely coupled components (VISION) |
1466 | 1477 |
|
1467 | 1478 | ---- |
1468 | 1479 |
|
|
1494 | 1505 |
|
1495 | 1506 | ---- |
1496 | 1507 |
|
1497 | | -### Planning (Team velocity ~12 Story Points) |
| 1508 | +### Planning (No design/workshop) |
1498 | 1509 |
|
1499 | | - * [0.0.1] Parse feeds (3SP) <- COMMIT |
1500 | | - * [0.0.2] Handle buy (8SP) <- COMMIT |
| 1510 | +#### Estimates |
| 1511 | + * [0.0.1] Parse feeds (3SP) |
| 1512 | + * [0.0.2] Handle buy (8SP) (~3x more complex than [0.0.1]) |
1501 | 1513 | * [0.0.3] Handle sell (2SP) |
1502 | 1514 |
|
| 1515 | +--- |
| 1516 | + |
| 1517 | +#### Commitment (Team velocity ~12 Story Points) |
| 1518 | + * [0.0.1] Parse feeds <- COMMIT (3SP) |
| 1519 | + * [0.0.2] Handle buy <- COMMIT (3SP + 8SP) |
| 1520 | + |
| 1521 | +> Story Point - a number that tells the team how hard the story is |
| 1522 | + |
1503 | 1523 | ---- |
1504 | 1524 |
|
1505 | 1525 | ### Sprint - Let's do it! |
|
1657 | 1677 |
|
1658 | 1678 | ---- |
1659 | 1679 |
|
1660 | | -### TDD/Refactor - Extract to separate files if needed |
1661 | | - |
1662 | | -```cpp |
1663 | | -#ifndef CONCEPTS_MARKET_DATA_HPP |
1664 | | -#define CONCEPTS_MARKET_DATA_HPP // concepts/market_data.hpp |
1665 | | -
|
1666 | | -namespace trading_system::concepts { |
1667 | | -inline namespace v1 { |
1668 | | -
|
1669 | | -using MarketData = decltype( Callable<void()>($(connect)) && |
1670 | | - Callable<void()>($(disconnect)) ); |
1671 | | -} // v1 |
1672 | | -}} // trading_system::concepts |
1673 | | -
|
1674 | | -#endif |
1675 | | -``` |
1676 | | - |
1677 | | ----- |
1678 | | - |
1679 | 1680 | ### TDD/Refactor - Cleanup the code |
1680 | 1681 |
|
1681 | 1682 | ```cpp |
|
1700 | 1701 |
|
1701 | 1702 | ---- |
1702 | 1703 |
|
| 1704 | +### TDD/Refactor - Extract to separate files if needed |
| 1705 | + |
| 1706 | +```cpp |
| 1707 | +#ifndef CONCEPTS_MARKET_DATA_HPP |
| 1708 | +#define CONCEPTS_MARKET_DATA_HPP // concepts/market_data.hpp |
| 1709 | +
|
| 1710 | +namespace trading_system::concepts { |
| 1711 | +inline namespace v1 { |
| 1712 | +
|
| 1713 | +using MarketData = decltype( Callable<void()>($(connect)) && |
| 1714 | + Callable<void()>($(disconnect)) ); |
| 1715 | +} // v1 |
| 1716 | +}} // trading_system::concepts |
| 1717 | +
|
| 1718 | +#endif |
| 1719 | +``` |
| 1720 | + |
| 1721 | +---- |
| 1722 | + |
1703 | 1723 | ### And so on... |
1704 | 1724 |
|
1705 | 1725 | ---- |
|
1747 | 1767 |
|
1748 | 1768 | <img style="background:none; border:none; box-shadow:none;" src="images/checks.png" /> |
1749 | 1769 |
|
1750 | | -#### Merged by a team member, only if: |
| 1770 | +#### Merged by a team member, only if DOD is satisfied: |
1751 | 1771 | * All code review dicussions were resolved |
1752 | 1772 | * All checks are passing |
1753 | 1773 | * All tests/static,dynamic analysis, etc... |
|
1761 | 1781 | | | [0.0.2] Handle Buy | <- Take the next story... (in priority order) | |
1762 | 1782 |
|
1763 | 1783 | <img style="background:none; border:none; box-shadow:none;" src="images/done.png" /> |
1764 | | -* #### Pair with someone else of the team! (knowledge sharing) |
| 1784 | +#### Pair with someone else of the team! (knowledge sharing) |
1765 | 1785 |
|
1766 | 1786 | ============================================================================== |
1767 | 1787 |
|
|
0 commit comments