Example of smalltalk-dev-plugin: Money class for calculations
# smalltalk-dev-plugin: Money class example This repository showcases a project created by [smalltalk-dev-plugin](https://github.com/mumez/smalltalk-dev-plugin). The source code in this repository was actually generated from the prompt below. ## Prompt ``` /st-buddy I'm a Smalltalk beginner. I want to create a Money class that can perform arithmetic operations across different currency units. Please help me from the project initialization. ``` ## Video You can watch the actual development process in the video below. [](https://youtu.be/FsIX0DVkOvg) ## Generated source You can see the [src](./src) directory. The following packages were generated: - **BaselineOfSampleMoney** — Project baseline configuration - **SampleMoney** — `Money` class and `ExchangeRateProvider` class - **SampleMoney-Tests** — `MoneyTest` test class ## Try It in Pharo If you would like to try the generated source code in a live Pharo environment, you can load the `SampleMoney` project using Metacello: ```smalltalk Metacello new baseline: 'SampleMoney'; repository: 'github://mumez/smalltalk-dev-plugin-money-example:main/src'; load. ``` Once loaded, verify that all tests pass: ```smalltalk MoneyTest suite run. "print it" ``` Here is a simple usage example: ```smalltalk ExchangeRateProvider reset. ExchangeRateProvider default setRate: 110 from: 'USD' to: 'JPY'. usd := Money amount: 1 currency: 'USD'. jpy := Money amount: 110 currency: 'JPY'. result := usd + jpy. ``` You can browse the `Money` and `ExchangeRateProvider` classes in the System Browser. You will notice that CRC-style class comments were also generated along with the source code.