There are not much thing in this example to improve with solid. But you can definitely improve this code design.
1. Make interface IFigure and move all properties like hight etc to interface.
2. Make all properties to private set in your figure class so that no one can access it.
3. Introduce constructor to pass all required values
4. In terms of solid, you can only give calculate responsibility to figure class..I don't find benifit of save as part of figure. Your save always overwriting previous figure..
5. Ideally figure should have some parent which can deal with create, save and delete of figure..
Ashutosh GuptaPosted Jan 6, 2020, 8:23 AM