Some thoughts on expanding SuccincT to provide richer interface contracts and auto-generated data classes
Recently I created a very simple framework, SuccincT. At it’s core is the ISuccess<T> interface. As I explained in a previous post though, by itself that interface isn’t much use. C# lacks the ability to define constraints on an implementation of ISuccess<T>, save through comments. The idea behind it was that an implementation should throw an exception if its Value is read when Success is false, but there is no way to guarantee that an implementation will exhibit this behaviour. This bugs me.
Unrelated to SuccincT, I’m a fan of defining data objects via interfaces, rather than concrete types. By “data object”, I mean any object that encapsulates a set of values. These might be used to avoid multiple parameters to a method or constructor, or to return a complex data set from a method. Data objects need not be immutable or serializable; they just need to be simple to use without causing problems when it comes to testing. As I like to encapsulate data, I like the setters of data objects to be internal, which does cause problems with testing. Thus why I like to use interfaces: the test class can define its own implementation, rather than having to fight against encapsulation. However, for every interface I create, I have to create at least one class too. This adds needless code to projects, which also bugs me.
These two things – wanting interfaces to define a more detailed contract and wanting to avoid having to write data object classes that can be 100% inferred from the interface – set me thinking: could I create some way of extending interfaces and avoiding writing data object classes?
Read the rest of the article
TweetShare This Post...
No comments yet, click here to be the first
C# equality in depth. Part 1: Basic == equality
Read the rest of the article
TweetShare This Post...
No comments yet, click here to be the first
C# equality in depth. Part 2: .Equals() and == are not equal
Read the rest of the article
TweetShare This Post...
No comments yet, click here to be the first
C# equality in depth. Part 3: IEquatable
Read the rest of the article
TweetShare This Post...
No comments yet, click here to be the first
SuccincT – A .NET framework to solve unexceptional exceptions & out parameter annoyances
The .NET framework is getting on a bit. Many users of the .NET framework are either resistant to API changes, or are stuck with binary-only 3rd party tools that would break with API changes. As a consequence of these two things, the .NET framework has aspects to it that go against modern thinking, but we are stuck with them. The solution to this is often to encapsulate those features within newer frameworks, which offer “best practice” facades on to those features. SuccincT is one such framework.
Read the rest of the article
TweetShare This Post...
No comments yet, click here to be the first
Is Test Driven Development the only future for software development?
This blog post was inspired by a brief twitter conversation between myself and Mark Seeman on how, in the future, developers will likely just write tests and how the computer will generate the code to make those tests pass.
Read the rest of the article
TweetShare This Post...
7 comments so far, click here to read them or add another
QCon London 2013 – Day 2
Read the rest of the article
TweetShare This Post...
1 comment so far, click here to read it or add another
QCon London 2013 – Day 1
Read the rest of the article
TweetShare This Post...
1 comment so far, click here to read it or add another
How Lapsang avoids two common forms of explicit casting
I have recently been working on how Lapsang might support both static and dynamic composition. In the process of thinking about these topics though, I’ve come to realise what mammoth topics they are. For example, in OO languages, we take for granted that there is a base class – often Object – that can define things like toString(). Because all classes inherit from that base class, all have access to toString(). However, Lapsang does not allow class inheritance. Thus even simple things like a toString() method have to use composition in order to be universally available. So defining how static composition works is taking longer than I expected, and I haven’t even started thinking about dynamic composition! Whilst working on composition, I started thinking about casting and what the syntax might look like in Lapsang. This led me to question whether Lapsang can avoid explicit casting altogether. The conclusion was yes, it can completely avoid explicit casting, sort of…
Read the rest of the article
TweetShare This Post...
7 comments so far, click here to read them or add another
Why we absolutely should never build software like we build houses
A few days ago, I read something truly depressing. It was a piece written by Leslie Lamport, “a computer scientist … member of the National Academy of Engineering and the National Academy of Sciences. [with a] Ph.D. and M.A. in mathematics from Brandeis University and B.S. from MIT [and he] works at Microsoft Research.” Yet for all these grandiose accolades, he demonstrates a depressingly clueless understanding of his subject matter: software. In his article, he argues that we should build software like houses. In this article, I’ll detail why attempting to create applications in the same way as building houses is a really bad idea, which held back software development for decades. Further, the reality is that these days, architects are more likely to design houses using techniques pioneered by the latest software development practices.
Read the rest of the article
TweetShare This Post...
7 comments so far, click here to read them or add another

