суббота, 17 февраля 2018 г.

New Project on Github: Grid.NET

Ok, this one is a long story. Frequently we need to search in a collection of objects. Typical solution is to store the collection not as List<Person> (because searching by Person.Name in a List<Person> will be O(N) operation), but as a Dictionary<string, Person> where key represents the name. Searching in this collection will be a O(log(N)) operation what is much better. The problem here is that if we want to search by name and last name we are forced to maintain 2 different Dictionary<string, Person>, one for the Name and second for the Last Name. But now there is something we can do about that.

Grid.NET is a NetStandard 2 project that can do the following:

As you can see, it allows you to define as much fields to query as you want.

Searching by index is effectively a O(1) operation in current implementation. Anyway it will be O(log(N)) in the worst case.

Besides that the cache allows adding and removing items and these operations are thread-safe.
The project now is in very early stage and there's still a lot of work to do, Readme file in the repository contains additional details.

As for the history of the projects, there was actually a task in my daily job that required similar functionality and we did not manage to find something that does that and did not have enough resources to implement that by ourselves. So I created such solution in my spare time. Most of work was done in November 2017 while I was at excellent conference BuildStuff 2017 in Vilnius, Lithuania (thanks for inspiration everyone) and during the flight from Rome to Moscow in that November too. This is the first considerably finished .NET project I did on my Mac and I used VS Code for the most things (it became the wonderful thing in last years) and JetBrains Rider for the most technically challenging parts (one can not do painless Expressions juggling in a text editor) that becomes pretty similar to Visual Studio that is in its own turn the most advanced IDE experience ever (I think so at least).

So I hope to put some more effort in this project in future and finish with at least the most important points and hopefully one time it will be used in a real application.

Will keep you posted, thanks.

Комментариев нет:

Отправить комментарий