Content that is all about creating interfaces and APIs in our programs! Find examples of code often written in C# along with tutorials.

ProjectXyz: Enforcing Interfaces (Part 2)

Enforcing Interfaces This is my second installment of the series related to my small side project that I started. I mentioned in the first post that one of the things I wanted to try out with this project is coding by interfaces. There's an article over at CodeProject that I once read (I'm struggling to dig it up now, arrrrrghh) that really gave me a different perspective about using interfaces when I program. Ever since then I've been a changed man. Seriously. The main message behind the article was along the lines of: Have your classes implement your interface, and to be certain nobody is going to come by and muck around with your class's API, make sure they can't knowingly make an instance of the class. One of the easiest ways to do this (and bear with me here, I'm…

2 Comments

ProjectXyz: Why I Started a Side Project (Part 1)

ProjectXyz Alright, I'll admit it... Even for a placeholder name on a side project it's pretty terrible, right? Well, my apologies. So, if you made it to this post you might be wondering what ProjectXyz is and why I started it up. From a high level, I started working on ProjectXyz so that I could have a hobby programming project to tinker with and I figured I'd blog about my adventures in bringing it all together. I plan on making this a mini-series documenting some of the things I'm learning or experimenting with, so this will serve as the intro to the series. Before we get too far, here's the link to the GitHub site: https://github.com/ncosentino/ProjectXyz Why Have a Side Project? Here's the main thing I want to talk about in part 1 of this series: Why should you have a…

3 Comments

Controlling a Myo Armband with C#

Background Thalmic Labs has started shipping their Myo armband that allows the wearer's arm movements and gestures to control different pieces of integrated technology. How cool is that? My friend and I decided we wanted to give one a whirl and see what we could come up with. We're both C# advocates, so we were a bit taken back when we saw the only C# support in the SDK was made for Unity. We decided to take things into our own hands and open source a Myo C# library. We're excited to introduce the first version of MyoSharp! The underlying Myo components are written in C++, and there's only several functions that are exposed from the library that we can access. In order to do this, we need to leverage platform invocation (PInvokes) from C# to tap into this functionality. Once you…

16 Comments

Refactoring For Interfaces: An Adventure From The Trenches

Refactoring: Some Background If you're a seasoned programmer you know all about refactoring. If you're relatively new to programming, you probably have heard of refactoring but don't have that much experience actually doing it. After all, it's easier to just rewrite things from scratch instead of trying to make a huge design change part way through, right? In any mature software project, it's often the case where you'll get to a point where your code base in its current state cannot properly sustain large changes going forward. It's not really anyone's fault--it's totally natural. It's impossible to plan absolutely everything that comes up, so it's probable that at some point at least part of your software project will face refactoring. In my real life example, I was tasked with refactoring a software project that has a single owner. I'm close…

1 Comment

What Makes a Good API?

Background My position at work allows me a bit of freedom in how I code and more importantly, influence how others code. I was recently having a conversation with a colleague about what I think makes a good API, from a high level. The context of our discussion was pertaining to developing a C# based API, but this really applies to any object oriented API. I had two key points that I wanted to address, and while they're not the only important things, I believe they're often overlooked. The first thing is how people will use your API, so how they will call methods and use the results. The second point was about how people will implement your API should they want to extend your work and implement their own classes. Here's what I was trying to drive home:   Usage: As a programmer,…

3 Comments

End of content

No more pages to load