I am a ways into developing an client that communicates with a pre-existing server using the Actionscript Message Format (AMF). I love designing my GUI in Flex, as I've found refactoring my GUI to be very straightforward since everything is nested well in the mxml file. However, there is alot to be desired in the API's that are available. I've worked around most of the problems, but the one issue that I can foresee struggling with is that I have some spatial data(a 2D grids of a half million objects, and there are dozens of these grids like this) that I will essentially either have to handcode a spatial indexing component, or just iterate through the data, which I'm afraid will end up performing very poorly and/or be alot of work.
I would like to try using the spatial indexing of Microsoft SQL Server. Also, if I could code most everything in C#, and somehow interop with the ActionScript GUI, then that would be great, as I could take advantage of the libraries available for .NET.
This is the jist of my existing design:
- Client connects to a server via a socket
- Server periodically sends AMF objects to the client
- Client maintains a data model and updates the data model based on data it receives from the server
- GUI Displays binded data, and allows the user to invoke commands that send commands to the server in the form of AMF objects, and then receives some sort of response.
- The majority of the code I have right now are the declarations of all the classes that the server could send, and the plumbing that processes communications with the server. There are dozens of classes, with each holding an average of half a dozen properties, and some supporting code for debugging the objects and performing copyto operations(for example if I get an updated object, I can't just assign a reference in the data model to the new object... you need to perform a deep copy of all the properties and objects from the AMF object, copying to the data model in the client).
These are the ideas for how I might redesign my application: 1) Expose an MS SQL Server 2008 instance through a web service. I don't know the details on the different ways I can do this, but I know it can be done. I am not worried about security as this will be running on a local machine with no ports open anyhow. Any portions of the data that I receive from the server which are spatial, I will send through this web service, and then query the web service when I need to query the spatial data.
2) Use remoting or some sort of web service to communicate with a .NET component. I could either reimplement all of my code and GUI in .NET, and have the Flex application simply proxy updates and commands to/from the server. My concern with this is the complexity of sending the commands from the .NET component back to the Flex application. I don't know alot about web services, but from my brief experience with WFC, any type of delayed callback from the service to the client seems to be fairly tricky and full of gotchas.
2.b) Alternatively, just move the spatial data into .NET where I would connect to the SQL Server from, and the only interop between Flex and .NET would be to send and query the spatial data.
3) I could use AMF.NET and completely eliminate the Flex client, but the incompletetness sounds sketchy. At least with #2 above I know that the AMF and remoting implementations that I'd use would be complete. AMF.NET would probably make things simpler since there'd be one layer instead of two, allowing me to completely eliminate the Flex client, but I don't know if I will run into problems with the AMF.NET library.
Out of these, #3 would be the most appealing if it wasn't for the fact that the library does not sound mature, and it will allow require all existing code to be rewritten in C#, which would be a pain at first, but I think be great in the long run (I almost think I could hack together a translator at least for type declarations to make this faster. varName:String becomes String varName).
So my very inspecific question is, what ideas and suggestions might you have? What pitfalls might I find with each approach? Bearing in mind my experience with web services and remoting is limited, so suggestions about specific technologies/libraries among these are welcome. This will be one of those opportunities to learn something new, but I don't want to get too bogged down if it is likely to be overly complex. I have about 4 years experience with desktop C# applications, and about 100 hours experience with Flex from working on this little project. Thanks in advance. My apologies if this shows up twice. I think I failed at the captcha but it didn't tell me, and after a few minutes I didn't see my question show up.