Specialising a General Application

Currently our application at work is used by all employees - sales staff, legal team, marketing, accounts etc. This means we have one very large, and general fit application. It covers everyone’s needs just, and the largest group of users (sales in this case) have an application which closely matches what they need. This is at the expense of the other teams having an application that is not quite right - close, but could be better....

February 2, 2014 · 2 min

Winforms Design Time support: exposing sub designers

When writing a UserControl, it is often desired to expose one or more of the sub-controls design-time support to the user of your control. It is reasonably straight forward to do, and here is a rundown of how: We start off with our UserControl, in this case the imaginatively named TestControl: The code behind looks like this: [Designer(typeof(TestControlDesigner))] public partial class TestControl : UserControl { public TestControl() { InitializeComponent(); } [DesignerSerializationVisibility(DesignerSerializationVisibility....

October 29, 2012 · 2 min

Designing the EventDistributor

When it comes to developing a new class, I don’t tend to use TDD (Test Driven Development), I favour something I have named TAD - Test Aided Development. In other words, while I am for Unit Testing in general, designing something via writing tests sometimes feels too clunky and slow. I always write classes and methods with testing very much in mind, but I do not generally write the tests until later on in the process....

April 23, 2012 · 7 min

Model View Presenters: Composite Views

Table of Contents: Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … When working with MVP, it won’t be long before you come across the need for multiple views on one form. There are several ways to achive this, and which you choose is really down to how you intend to (re)use your views. The first method for dealing with the sub views is to expose them as a property of your main view, and set them up in the main view’s presenter:...

March 29, 2012 · 3 min

Model View Presenters: View to Presenter Communication

Table of Contents: Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … Communicating from the View to the Presenter is a reasonably straight forward affair. To signal something happening, we use an Event, but one with no parameters. We pass no parameters, as we are not going to be using them anyway, so what is the point is raising an event every time with OkayClicked(this, EventArgs....

January 31, 2012 · 3 min

Model View Presenters: Introduction

Table of Contents Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … What is MVP? I first came across MVP in Jeremy Miller’s Build Your Own Cab series, and have been using and improving how I work with this style ever since. Model View Presenters tend to come in one of two forms: Passive View, and Supervising Controller. I am a fan of the Passive View variety, primarily for the testing aspect, but also as I find it provides me with the best level of separation....

January 26, 2012 · 1 min

Model View Presenters: Presenter to View Communication

Table of Contents: Introduction Presenter to View Communication View to Presenter Communication Composite Views Presenter / Application communication … Presenter to View Communication There are two styles utilised for populating the View with data from the Presenter and Model that I have used. The only difference between them is how tightly coupled you mind your View being to the Model. For the example of this, we will have the following as our Model:...

January 26, 2012 · 2 min

Noticing Changes

I work on a piece of software that has been around for about 6 years now, which looks something like this: The textboxes are validating that their contents, some as decimal, and some as integer. All the textboxes consider no-value to be invalid. I made a slight change to the control, which was to add a new row. Since adding that row, many users have sent in requests to have the validation changed on the textboxes, so that no-value is considered to be zero....

October 22, 2011 · 1 min

(Miss)Use of Narrowing-Implicit Operators

I have covered a use of Narrowing/Implicit Operators before, but I was thinking the other day about use of Fluent Interfaces, and if it was possible to have one on a cache/repository type class, that would allow you to chain options together, but stop at any point and have the result. I gave it a go, and came up with this: public class Person { public string Name { get; set; } public int Age { get; set; } public Person(string name, int age) { this....

March 17, 2011 · 2 min

Expression Rules, Version 2

Recently I have written a rules engine for a very large menu system in an application I work on. Many of the rules apply many items, so I didn’t wish to have to express the same rule many times. To avoid this, the rule engine DSL was born: Concerns.When(item => /* rule of some sort */) .AppliesToAll() .Except(MenuItems.ToggleHidden, MenuItems.Refresh) And rules are rolled together, so a specific menu item must have all of its rules evaluating to true to be displayed....

February 9, 2011 · 2 min