Ramblings of a .NET Developer

5 October 2014

Sunday, October 05, 2014 | by Paul | Categories: , | No comments
Well, after 20 years of developing Windows applications, both WPF and WinForms, Windows Services, WCF Services and all that good stuff, I'm finally being pushed to actively work more in web development.

I've been thinking (putting off) about this for a few years, but it has moved so far that I can't ignore it any longer.

Luckily, although I'm a contractor, my work is pushing me to get up to speed and I'm fortunate enough to work with some seasoned web developers.

So I'm getting to experience the wonders of JQuery, Javascript, Razor, Bootstrap, ASP.NET MVC and all the little quirks that go with them.

Oh, Node, Meteor, TypeScript are also in my firing line.

And there's some really cool IDE's like brackets and LightTable.

Lots of learning and headaches ahead, but it's nice to be developing with technology that is new to me.


22 September 2014

Monday, September 22, 2014 | by Paul | Categories: , , | No comments
So, it's been about 6 years since I last did any winforms development, but my current contract requires me to develop some applications using WinForms whilst others can be done in WPF and yet more stuff is web development. So, I've got quite a bit going on, which is great as I need to brush up on stuff other than WPF.

I didn't develop Clarity with the view of using it in WinForms, but decided to use it anyway as it was a good exercise in testing it's compatibility.

As it turned out, I didn't have to change too much. I introduced a new CommandBuilder interface and implementations in both WPF and WinForms. I've also introduced a Clarity.WinForms library which is akin to Clarity.WPF to allow people to get more features out of the box.

In Clarity.WinForms, I created a couple of extenders to allow developers identify bindings in the designer. These are PropertyBinding and CommandBinding. The PropertyBinding allows you to identify the property in the ViewModel a control should be bound to. Likewise, the CommandBinding allows you identify the IClarityCommand to execute when a button is clicked.

I've also added 3 additional example applications.

The first is a WinForms earnings calculator. It's a simple one window application that will calculate the amount you've earned that day.

Here is a screenshot of the designer.

This shows the Income control selected, and the PropertyName highlighted on the Properties window. This is available because I've included the PropertyBinding extender. For this sample, I'm binding it to the IncomeAmount property which is on the Income property of the ViewModel.

Normally, for an application like this you would see click event handlers for the buttons, code to validate the data, and code to set the values on a ViewModel or Model.

In the world of Clarity, most of the code is removed, with only a binding added for the ComboBox.


As all UI components in Clarity, this is a UserControl, but instead of inheriting from UserControl, we inherit from Clarity.Winforms.View. This provides helpers for binding controls and handles where the ViewModel has not yet been created.

Once a ViewModel has been associated with the View, the BindViewModel virtual method is called.

We override it here, to allow us to bind the ComboBox to a datasouce provided by the ViewModel (FrequencyList), the selected value property "Income.Frequency" and an optional Converter, in our case I'm using an EnumConverter as the Frequency property is an enum.

Running the sample should show the UI, bound to a ViewModel and being updated from the ViewModel via an internal timer.

To test validation, tick the "Make Form Invalid If Frequency is Day" then select the Day option in the Frequency dropdown. This should make the form invalid and show the good old WinForms validator error icon.



I've also created a more comprehensive sample in the FileExplorer folder. This shows a common ViewModel library being consumed by WPF and WinForms UI versions. The pain point with this was the TreeView binding. To help, I've created a BindableTreeView control in Clarity.Winforms that helps with the sub-tree bindings.

This WinForms part of the library is still work in progress but hopefully this is a reasonable start.

5 May 2014

Monday, May 05, 2014 | by Paul | Categories: , | No comments
Just come across this GitHub site that is maintaining a list of free programming related books...

https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md

Cool!

4 May 2014

Sunday, May 04, 2014 | by Paul | Categories: , , | No comments
I've been a computer programmer for over 20 years now, enduring framework after framework, changes in technology, changes in how we should develop, being told this is better, or that is better. Sometimes I really get fed up with it.

For the experienced programmer, we just want to develop a system/application as we know how it should be done and not force new tech on us just for the sake of it - especially whilst we are developing that project. I for one, want to produce an end result on time, and something that I'm pleased and confident with.

The state of development projects never seem to get any better either. How many failed I.T. projects have been highlighted over the years, costing governments millions and taking years to complete or getting scrapped?

Surely, with the rise in various methodologies, one of them must work? Or maybe we are doomed because the fundamentals or I.T. development is just wrong?

Traditional Factories

Looking back at my days as a Mechanical Engineer (some 25 years ago) things we different, and working for a manufacturing company that developed railway components, the correct processes and procedures were in place to produce components that were developed and delivered on time and were properly quality controlled.

In a factory, a product or component is not developed on the fly. It has gone through a process of R & D, quality controlled, reviewed, re-visited and then after that is then adopted and is viable for inclusion in larger projects or as a product that can be sold as is.

Where I worked, each part of the process was timed, with Route Cards showing the process of taking a raw piece of material through each defined step to finally end up with a finished product. Each part of the process required a Job Card, allowing the individual worker to indicate the time taken for their bit of the work. All this was fed back into the EFACS system (does this exist any more?) and used to more accurately estimate production times etc.

In a factory, if a new product is being designed, then the R & D to do that is a project in itself and can be time boxed if necessary.

The I.T. Factory

In I.T., we don't have the same rules. We must developed a system, include new technologies/techniques/frameworks as we go (often just for the sake of it), take on more complexity and still give accurate estimates on how we are tracking and if we are on time. Naturally, we can only guess, and quite often we are miles away from the true figures.

We are expected to do the R & D while we develop, be agile, handle change, work with Project Managers that add their spin on how things should work and worse, tell us one thing and tell the project sponsors another...

It's no wonder that projects fail. And if it doesn't fail, how much of that software is re-written for version 2? And how much has to be re-written because the business process has changed?

The funny thing is, the end users of the software don't care if it uses this framework or that framework or technology. They just want it to work, improve their job role and make things easier for them and/or perform their role more efficiently.
Instead, they end up with software that is already creaking at the seems, is slow, buggy, does not make their lives any easier and sometimes makes it worse.

So, how can this be fixed?

1) Start dedicating resources to R & D projects. This will allow us to focus on new technology in a controlled manner, which can be time boxed and give the development team a chance to understand how 3rd party frameworks should be used.

2) Don't to R & D in a project.

3) Use the skills of the team. If they need to learn something for the next project, then it must be recognized that time needs to be allocated for that learning.

4) Learn from environments that work and have been working efficiently for years.


9 April 2014

Wednesday, April 09, 2014 | by Paul | Categories: , , | No comments
So, I've wanted to do some development in the mobile space for the last few years now, and always managed to put it off, change my mind over technology/platform etc, etc.

Well, I decided to go to a meetup a few weeks back. This was quite good as I was suddenly discussing things with other people actually doing something in the mobile space. This was from people with ideas to developers to people paying other developers to do the work.

The other part of the meeting was that everyone had to set a goal for the next meeting.

So, I've committed to releasing an app!

I've even got an idea - which is a minor miracle as I can never usually think of anything decent.

As I'm an Android owner, that's my target platform, and I'm going to a native app to get the experience of the process.

It's funny how the recommendations went on how to do it at the meeting.

All the devs were saying stuff like, go native or use a cross-platform framework, whilst all the non-techies were saying to contract the work out. I can see the point of contracting it out from a business point of view....but, I'm a dev and want to get my hands dirty and also get an appreciation of what's involved.
If it looks like it could work, then I might contract some work out later.

11 March 2014

Tuesday, March 11, 2014 | by Paul | Categories: , , , | No comments
I uploaded my WPF based client framework (Clarity) to codeplex over the weekend.
If anyone is interested, here is the link.

Now all I need to do is add more samples, make it portable and more tests and add more features as needed.

I really need more hours in the day...

It would be good to get some feedback and see what can be improved.