Tips on designing a .NET API for future use with F#
Posted
by Drew Noakes
on Stack Overflow
See other posts from Stack Overflow
or by Drew Noakes
Published on 2010-06-07T16:34:20Z
Indexed on
2010/06/07
17:32 UTC
Read the original article
Hit count: 293
I'm in the process of designing a .NET API to allow developers to create RoboCup agents for the 3D simulated soccer league.
I'm pretty happy with how the API work with C# code, however I would like to use this project to improve my F# skill (which is currently based on reading rather than practice).
So I would like to ask what kinds of things I should consider when designing an API that is to be consumed by both C# and F# code.
Some points.
- I make fairly heavy use of matrix and vector math. These are currently immutable classes/structs.
- The API currently defines a few interfaces with the consumer implements (eg:
IAgent
), using instances of their implementations (eg:MyAgent
) to construct other API classes (eg:new Client(myAgent)
). - The API fires events.
- The API exposes a few delegate types.
- The API includes several enums.
I'd like to release a version of the API as soon as possible and don't want to make major changes to it later if I realise it's too difficult to work with from F#. Any advice is appreciated.
© Stack Overflow or respective owner