Hello,
As a structural engineer & phd, I’ve used Rhino & Grasshopper for more than 10+ years in my day to day business. I’ve coded hundreds of scripts and a few Rh/Gh plugins, mainly in C# + RhinoCommon. All this works at a certain complexity level.
Although I come from an “AEC background”, programming has always been a second skill to me. However, I feel I would benefit to take this skill to the next level in terms of software architecture.
1) Best practices / Resources
What resources (book, blog, youtube, …) would you recommend to gain practical knowledge in designing small scale C# softwares in terms of architecture : inheritance & interfaces, types, data modelling, patterns ? Something useful to make real life decisions, not too abstract/generic but yet conceptual.
2) (Generic) Use case
Frequently, I want to develop a standalone core library with some logic. Usually it’s a sort of computational engine (MyEngine.Core
). In this single-file-library I want:
- as few external dependencies as possible and easy to test independently
- easy to embed in other softwares / ideally cross platform
- provide a minimal usage of it through a basic console application with input/output files
In the other hand, because all I do ends in Rh+Gh for its power, I also want to provide a kind of GUI to this library (MyEngine.Gh
for a Gh plugin) :
- easy to build the inputs through rhino geometry
- easy to visualise results of the engine
- use existing plugins
- easy to distribute to others
What I am describing here is a case where the MyEngine.Core is fully independent of Rhino. This would not be the case if my logic relies on complex nurbs operations or Rh types such as Curves or Surfaces.
In this use case, what kind of architecture would you recommend ?
-
Resort on interfaces in the
MyEngine.Core
and implement those interfaces on custom Types and Parameters in Gh. I can then pass those types directly to theMyEngine.Core
logic to do the computations ? -
Resort on concrete classes in the
MyEngine.Core
and extend (or simply embed ?) those types in custom Types and Parameters in Gh ?
Thank you in advance for your advices.
If “part 2” needs a more precise example, I can provide one.