CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

December 2005 - Posts

  • C sharp and D flat. (VS) 2005 and (Delphi) 2006

    The .net framework and the C# language are very much indebted to Delphi. Both bear the mark of their common maker Anders Hejlsberg.

    I have a long history with Delphi. In the first days of the PC Turbo Pascal was the thing which brought real programming to the PC. It was a true and fast compiler for a powerful programming language in an integrated editor/build/debug environment. In the 32-bits Windows world Delphi was a best of breed. It offered a full OOP language with a good class library containing database support integrated in its core with a good project-, form- and code- editor. In the Delphi 5/.NET beta days I was working with COM in Delphi and one of my targets was (COM interop in) .NET. Soon I was fascinated by the new world of .NET with those xml-datasets and web-services. The first incarnations of the web service client in Delphi 6 could not work with the complex types returned by asp.net web services. I wrote a component to get that to work. The continuous feedback I receive on that is an indicator on work being done on .NET - Delphi interaction. The last few months the amount has increased; apparently the interest in .NET has risen amongst the Delphinians.

    Having seen .NET 1.0 I stayed with Visual Studio; which made me an early Delphi defector. In those days most Delphi people considered C#/.NET a (bad) copy of Object Pascal/VCL framework. C sharp as a synonym for D(elphi) flat. Which, amongst less amusing ones, resulted in musical discussions. Is the pitch of C# the same as Dflat ? On a piano it is; but on an instrument with "real" pitch, like a violin, it is not. Was VS 2002 a better tool to build (Windows) applications than Delphi ? It is the same Win32 api they are targeting. At the time there were more components for Delphi than for VS. These days are quite different. The success of .NET cannot be denied and also Delphi has adopted .NET. But recently I bumped into a blog titled Dflat. Which has a very nice story on what's wrong with C, was more or less Ok in Delphi and works like it should in C#.

    So Delphi has a rich history and could have a great future. The a new version is quite optimistically called Delphi 2006 and does support .NET. Alas it is the 1.1 version of the framework. No asp.net 2.0 and no generics. Borland (the company owning Delphi (at this moment)) is working on support for the latter in the Delphi compiler. I know just about enough about compilers to understand this is a difficult job. The Delphi compiler is fast, very fast. It is fast because it compiles your source code in one pass. Just like Turbo Pascal. This requires some fiddling with forward declarations when types have a mutual dependency. The .NET languages C# and VB.NET compile in several passes; it's ok to use a type which is declared later on in your source. Thinking about the internals of generics and partial classes makes my head spin; starting to think how to solve all that in one pass makes me totally dizzy. There is a lot to do but the resources get fewer and fewer. Recently chief compiler builder Danny Thorpe has left the company (to join Google).

    Why am I ranting ? I still work with Delphi (5&6) quite often. I have a loads of memories on Delphi. Good and bad. I was always interested in the new developments. But now I think it is over. Borland has been trying to do too many things at the same time. A new language, a new IDE (whose first incarnations were just bad), new enterprise tools, a new database library, new web libraries, backward compatibility and newest technologies . But you just cannot beat Visual Studio, team system, ado.net, asp.net, VS - conversion wizards and C# 2.0 with a (compared to ms) small company. I think they should have followed the path which Chrome took. Chrome is an Object Pascal (with extensions) compiler which uses VS as IDE. Just doing what it is good at.

    The only thing I never liked about Delphi was it's pricing. An MSDN universal subscription is cheaper than a Delphi enterprise license. With at least one major Delphi version a year I'm far cheaper of with VS. These days my mailbox is flooded with (cheaper and cheaper) offers to buy Delphi 2006. But looking forward to 2006 my best (educated) guess is with VS 2005, and not Delphi 2006. Not even a a trial. Sorry, it's over. It hurts me too.... (please don't flame me..)

  • Nintendo meditation (my first PDA)

    This holiday a lot of kids will get their first information processing device. After that their life will never be the same again.

    My son Cas, wishing you a merry Christmas.

    (Having portrayed my eldest Niek selling MSDN leftovers and my youngest Mees playing with a tablet PC jr, Cas deserved his place as well.)

    Peter

  • Contract first development (Christian Weyer spoke for the SDN)

    Last Friday, December 9th, the Dutch user group SDN had a meeting. A lot of people turned up, demonstrating that blogs and other internet stuff are still not (and never will be) all there is. There is no substitute for meeting and talking with real live people.

    My favorite presentation was on Contract First development by Christian Weyer. He's been giving this talk for some time. Last year for DotNed, the other Dutch user group. It is an evolving story, at the moment the content is hotter than ever. Christian has some great ideas on the subject, is quite passionate about them and gets carried away presenting it. Which leads to a hell of a presentation. Let me give you a short resume. Thanks to my glasswork I've been able to catch both speaker and the highlights of his slides, so Christian can do the main part of the talking himself

    The Visual studio template to create a  webservice generates skeleton code:

    The problem with this code is that is just a class whose methods are wrapped up with attributes. The webservice is used by making RPC (remote procedure calls) to some webservice object.

    This does not fit very well in world of real world of communications:

    There is a mismatch between webservices VS template style and message based systems as seen in service oriented architecture.

    You cannot describe all aspects of services, messages and contracts in just a class. The real world has more aspects:

    Instead of starting with code you should start with the contracts which describe the messages to exchange and the operations which accept and transmit messages. All of this can be described in XML schema.

    This contract is going to be the base for generating the implementation of the webservice. That's where Christians Contract first tool enters the story. Like a real VS add-in it is started with a right click. It can generate two kinds of code: a server stub to implement the service and a client side proxy to consume it. The tool is free for download. It's also works for VS 2005. In Christan's words it's more or less 'pre-alpha' which requires some crossing of thumbs. In his demo it worked like a charm.

    The essential point of the story is that a webservice is based on a contract. At the moment this contract is written out as an xml schema (xsd) which can be  understood by a variety of platforms. These contracts specify services in some specific domain. Being a good German Christian's domain were restaurants. When people agree on what the contracts in a specific domain should look like (after all a contract should be an agreement) you have building blocks for developing software for that specific domain. And the start of a domain specific language. Another whole new thing...

    What the role and form of these contracts will be in the future remains an open question

    I can't wait to see more glimpses at the next user group meeting.

  • Charles Petzold, WPF and the Tablet PC

    Charles Petzold's book Programming Windows is a classical masterpiece. Through his work a whole generation learned how to write programs for that new strange graphical operating system called Windows. As that grew in size over the years the new editions of the book got thicker. A copy of the fifth edition book is still a cornerstone under my daily work

    Being used to MS-DOS the Windows API was pretty complex. I have grown up with Delphi, whose VCL (Visual Component Library) is a framework which hides the Windows api itself. The VCL came with source code. In your programs you would use the components from the framework and in Petzold's book you would read what the code actually did. In the .NET framework the (presentation part of the) windows api is encapsulated in the System.Windows.Forms namespace. The .NET framework does not come with sourcecode. Petzold's book is still close at hand but these days mainly has a physical support task.

    The Window Presentation Framework (WPF) is the new presentation layer of the upcoming Vista OS. The best news is that Charles Petzold is writing a book on WPF and has a beautifull blog on that. Petzold's writings are very much into the heart of the matter. New projects in Visual Studio always contain an amount of generated code; Charles starts with an empty project and adds functionality line by line. Step by step you will understand how the technology really works. This is going to be the way to learn WPF.

    Just like me, CP has a weak spot for the tablet PC. There are not many books about the tablet, actually there is only one which matters when writing tablet code. But that book is not complete as it does not cover the real time stylus (RTS) api, which is going to be quite important in Vista. Quite recently CP has published a great article on the RTS for MSDN magazine.

    Besides being a great writer he is also a great presenter. Last year I've seen at WIndows anywhere feb 2005 his presentation Ink as a graphical medium, where he dances around with a tablet on his arm.

    Lovely show. Now I just have to see his mini-keynote Programming for Windows 1.0,  Once.

More Posts

Our Sponsors

Free Tech Publications

This Blog

Syndication

News