Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Saturday, September 12, 2009

Merging dictionaries in Silverlight 3

In Silverlight 3 you can merge dictionaries. Something that I really like because it enables you even better to separate reusable things from one time things.

When you try to do that, watch for a couple of things.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/S7Silverlight;component/Themes/Generic.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Don’t forget: (1) the slash before the name of the Assembly and (2) to put component/ before the path to the resource file in the assembly

Just thought it might save you the hour I just spent.

Bye,

Bart

Thursday, June 11, 2009

My first unit test

As mentioned before I’m starting the (re)design for our upcoming major release. This is an exciting time because we will be using a couple of new techniques here. One of which is DevExpress’ XPO, eXpress Persistent Objects.

I had done some tests before, but now the real work starts I find that typing the object model rather than drawing is a big down side for XPO. I’m afraid that in this day and age you really need a visual modeller.

That said, I’ve bitten the bullet and started the design. I took that a bit light-hearted and thought I would have done that in a couple of hours. You know, thinking: “what do I need to do different compared to our current object model? It’s all been done and we know exactly what we want”.

Not, I can tell you. I find that rethinking over the object model brings up a couple of flaws that only become apparent if you don’t think of databases anymore. If you think in objects only, you experience another kind of designing entirely. I’ve been object modelling for quite some time, but doing it for real while reverse engineering a larger model is quite different to what I did before.

But, the reason I started this post is I wanted to share my first unit test with you. I was looking in the XPO software for a ‘model checker’. Since XPO is about storing data, and you need to specify the object relations using ‘code’, I suspected I might have mistyped something somewhere and wanted to check of all was well.

That’s quite easily done, using a unit test. It’s ever so simple, but helps you to check the object model while designing. Just make the test project your current project, add a reference to the assembly that holds your XPO model (everyone puts that in a separate assembly, right?) and run the test when you want to check your model.

This is the single line test that has been my friend for today:

[TestMethod]
public void CheckValidityOfDicationary()
{
    new ReflectionDictionary().GetDataStoreSchema(typeof(S7XPO_Base).Assembly);
}

Replace S7XPO_Base with any of your persistent classes and you’re off. If there is an error, an exception is thrown and your test will fail, telling you exactly where the problem is.

Hope this is of use to anyone. It certainly helped me a lot.

Bye,

Bart

Sunday, June 07, 2009

Application Architecture Guide 2.0

http://apparchguide.codeplex.com/

I am in the middle of redesigning our software and was thinking through some major parts of our software design. We notice the number of clients grow, the size of the companies that uses our software gets larger (Microsoft, SAP, Google, Unit4Agresso, Shell are all companies that use our software) and the number of topics in the Sevensteps projects increase. Our software was designed for documentation projects of around 5000 topics per project (we have projects that are over 400.000 topics in size, but performance is an issue there) and I want to redesign (part of) our software to accommodate larger projects.

Another reason for redesigning is that we currently support one rich client interface. And I want to extend that with a content API (which will give access to the information from, let’s say, an ASP.Net application) and some light weight, web based interfaces. Some other parts of the software could do with a looking over too.

Going all over the net for some background information, I stumbled on the Microsoft Application Architecture Guide 2.0. I’ve now read the first 2 chapters and already got some very valuable information. I find that most things discussed, I already know about and have some experience with. But, to see them listed helps a lot.

I will be reading the next 300 pages or so to see how the topics are elaborated on. I’m not a very keen IT book reader, but will make an exception this time. Anyone looking for some guidance in designing (Microsoft based) software might find it a valuable resource too. If after reading I think a follow up is required, I will do so of course.

Bye,

Bart

Saturday, June 06, 2009

Just a few more words about the switch from Delphi to C#

Thanks for all your comments to my post about switching from Delphi to C#. Although I didn’t intend to stir up that discussion again, I would like to answer some of the questions and suggestions raised/

I appreciate everyone telling me about teaching C# programmers Delphi. I know it's not too hard; I've done it myself :-) But, the number of programmers out there does reflect the popularity of a platform, doesn't it? And some applicants bluntly told me they didn’t want to work in Delphi. They obviously didn’t get the job, but it did make me think a bit.

But, the lack of programmers wasn't the main reason for us to switch at all. Despite somewhat (...) critical sounds about Microsoft (some of which I tend to kind of share) there is a lot of development in the Microsoft world. Way more than in the Delphi world. Some may be good, some may be not so good or terrible, fact is that there is a lot of effort put in the MS platform.

What really did it for me were two things.

(1) We had to wait for Delphi 2009 for Unicode support, which (IMHO of course) is a major misjudgement. I haven't been able to deliver Unicode software, even though there was a bit of pressure out there. I know for a fact that I did lose sales because of that.

(2) About the same time Delphi 2009 (and Prism) came out, I attended the Microsoft PDC. It opened my eyes regarding to the scale of things. One may not like MS being enormous in size, but there are so many exciting things going on out there, that it made me decide to go the other way.

In fact, I particularly went to check out MS Surface. Just one of those things that MS can do and Embarcadero won’t. That’s not to hold against them, and it doesn’t have anything to do with my choice for C# really, but it did tell me that there was a lot more going on than I really wanted to realize.

Just a quick note on quality of tools: I was getting used to Delphi crashing on me several times a day. It was getting to a point that I did take that into account when starting a days work. I am so glad that is over: Visual Studio hasn’t crashed on me once since I started using it. Not a real argument for the choice either, but I’m glad that’s out of the way.

I will always love Delphi and will be programming in it for the next couple of years, I’m sure. But for the next few generations of our software engine, C#/.Net will be the platform of choice.

Now, that still doesn’t solve those designing issues for me :-) Guess I’ll have to do some investigation.

Bye,

Bart

Friday, June 05, 2009

Contemplating MVC for our software

I’m currently in the process of redesigning our software for a new implementation in C#/.Net. Our current implementation is great of course (…) but some considerations made us decide to move away from Delphi into C#/.Net. I’ve listed the reasons before, but to summarize here is a part of the introduction of our formal business case for going C#/.Net.

Microsoft will always invest more than Embarcadero will

As much as I like the Delphi world, there will be more development into C#/.Net than there ever will be into Delphi/Win32. It’s just a matter of size: MS is way bigger than Embarcadero and the number of developers for C#/.Net will always exceed the Delphi/Win2 group.

There are more C# developers than Delphi Developers

It’s a fact. I had a hard time to find experience local Delphi developers. There are plenty C# developers. To just mention a fact: the Delphi user group that I attended had between 5 and 8 developers on each meeting (every 3 months) and I was presenting on every meeting I attended. The dotned group I recently joined has meetings every month with between 20 and 50 developers every time. And the dotnet group is just one of many C#/.Net groups out there.

And there are numerous other considerations to make the move that I won’t mention here. All of them are commercial and strategic considerations, not technical ones.

So, there we go, we will redesign and implement our software.

Design decisions

There are a couple of little draw back to redesigning and reimplementing software (it will set you back a hell of an amount of money) but there are a couple of good aspects too. You can reconsider some design decisions you made earlier. You can apply new technology if you want to. Stuff like that.

There are two major decisions I am currently thinking over:

  1. Will I use DevExpress XPO or will I use the Microsoft Entity Framework for my ORM?
  2. Will I implement a ‘simple’ 3-tier model or will I go for a MVC model?

Deciding Object Relational Model

There is a bit of information available regarding the decision between XPO and the Entity Framework. I found Gary’s Blog (by DevExpress) highly informative. It’s been noted here that I am a huge DevExpress fan and am really considering building our software using XPO. But, the fact that Microsoft is behind the Entity Framework does play a role in my considerations. I haven’t gone into great detail investigating either technology (and I think I must to make a sound decision). It will be between those two I guess.

3-tier model or MVC model?

Our current app is more of a 2-tier model. The business logic is implemented next to the user interface and I want to move away from that. I am currently contemplating a MVC model or a ‘traditional’ 3-tier model. Our software will have a WinForms user interface as its main interface and most of the stuff out there is using ASP.Net (which I will use for only part of the editing work in our software).

I found this blog (http://rdn-consulting.com/blog/2008/02/01/selecting-a-mvcmvp-implementation-for-a-winforms-project/comment-page-1/#comment-1663) that kind of sums up my considerations.

I haven’t made any decisions on these issues, so any thoughts that you think are worth sharing are much appreciated.

Bye,

Bart

Thursday, January 08, 2009

Using Virtual Earth on Surface

I still haven't got the actual unit, but it should be somewhere between Germany and our office. Maybe today?

In the mean while I found http://blogs.msdn.com/publicsector/archive/2008/06/24/wpf-and-virtual-earth-revisited.aspx. This is an example on how to use virtual earth in a (proper) user control.

This helps a lot, as it will make virtual earth a 'normal' control. And it is now also pretty easy to use it on the surface unit (or at least the simulator). For our demo stages, this is good enough.

O the wonders of the work of others...

Bye,

Bart

Friday, December 19, 2008

Starting to blog about my C# experiences

Regular visitors to my blog know that I have been working with Delphi for the last decade or so. The love between Delphi and I has grown, although my old love (just about everything that Microsoft did and does) never died out. At regular intervals I did some things with VB, C++, C#, ASP and ASP.Net.

For me, 2009 will be a year where I will say goodbye to Delphi (for new things that is) and will move to C# and .Net for all of our software. There is just too big a gap between development in the C#/.Net world and the Delphi world, despite the recent releases of Delphi 2009 and Prism. Of course, that's IMHO only, but in my company that's what counts.

So, I will be writing more and more about C# and not that much anymore about Delphi.

The first new product that we will do will be using the MS Surface unit, which will be installed in my office the first week of 2009. I can't wait to get going with that. I'll keep you posted (as far as I'm allowed by MS, because I'm bound to a pre release agreement for the MS Surface unit).

Bye,

Bart

Ps: From now on I will only tag postings that are about Delphi only with the Delphi tag. Other postings (not tagged Delphi) won't get picked up by delphifeeds.com, so if you want to stay in touch, please RSS subscribe or come back on a regular basis.