Introducing my open source .NET library

One of my biggest plans has always been to publish source code. I’m a professional developer but it’s also my hobby, or more like my art, and I want to do something useful for the benefit of everyone. I’ve posted code a few times on my previous website, but nothing major or widely usable. The life-changing great idea still has yet to come, but I decided to stop waiting for it and publish whatever minor pieces of software I come up with in my free time. C#/.NET is my language/platform of choice, so I started putting together a library project on Google Project Hosting and license it under the GPL v3. It’s a totally generic collection of library routines that anyone might find useful. So here it is: the Joco Library.

Scope

First step of every project: define a scope. Like I said above, there are no specific goals or clearly defined limits to what fits in here. Basically it’s going to be a huge collection of small to medium library functions and classes that anyone can use. I stumble upon a lot of new technologies, interesting problems and reusable code in my dozen pet projects (some of which might be public someday, too), and the results will all appear in this project and this blog, too. I’m an advocate of quality programming so I’ll be very keen on keeping the source files clean and well documented and providing unit tests.

Next I had to choose a framework version, and I chose the latest, .NET 4. It was a tough choice, because I know I might lose some audience who have to stick to an older version, but I really wanted to use and actually learn the most up-to-date technologies available.

However, here’s a promise to those folks: if anyone wants to use the .NET 3.5 compatible subset of my library (and of course give me credit for it :) ), then I will provide and maintain it as a part of this project, until we decide that .NET 4 is deployed widely enough. I also promise that whenever someone starts using this library in another project, I will maintain proper support branches. Until then, it all goes into the trunk, and I’ll feel free to introduce breaking changes whenever I feel like it :) . Binaries will be provided sooner or later, possibly upon request. Let me also mention that I’m open to suggestions and bug reports of course.

What I’ve done so far

FejesJoco.Framework.Windows is a Windows-specific library which already contains some nice features, I’ll cover it in my next post. FejesJoco.Framework.Core is the most generic, platform independent library.

Let’s not talk about MathUtils.cs because I’ll rewrite the whole thing soon.

In InvokeUtils.cs, there’s a function which converts an Action to a Func<T> that always returns null. There are invoking routines which run some code in a different context (like COMInvoke in the Windows library), they expect a Func<T> so that they can return a value of type T, and in case you don’t need a return value, you don’t need to type a dummy return null statement, because this function encapsulates that.

In ReflectionUtils.cs, there’s a generic version of the GetCustomAttributes method. It’s sad to see that in .NET 4, Microsoft still doesn’t provide these convenience methods.

In StringUtils.cs, there’s a shorthand to replace string.Format. Again, why doesn’t Microsoft put the this keyword in static functions like that?

And that’s all for now. It’s a slow start, I know. But these functions appeared because I needed them in the Windows project for higher level functions, so they are already useful to someone :) . This already reflects how things are going to be: I find a new, interesting topic to investigate, and all reusable functions will go into the Core project. Soon there’s going to be tons of them, I hope.

Leave a Reply