PostSharp Blog

The official blog of PostSharp: annoucements, tips & tricks

Good News First

I am happy to announce PostSharp 2.0 RC 2, available for download now. From this release, the low-level library PostSharp.Sdk.dll has now a class reference documentation and all APIes are frozen.

Apart from lack of SDK documentation, the feedback from RC 1 is excellent. The number of reported bugs was historically small.

And Now Bad News

I will probably annoy a lot of people with this release but I had to do it.  I originally wanted to document PostSharp.Sdk after the RTW of version 2.0. Documenting is typically the moment I discover inconsistencies and correct them, breaking backward-compatibility. So by postponing SDK documentation to the next release, I also would also have postponed the promise of forward possibility, and forced many users to stay with PostSharp 1.5. So I decided to do this API clean-up and class reference documentation now

When documenting, I figured out there was some mess in the namespace organization, since some low-level APIes shared the same namespace of high-level APIes. So I did some clean up there. This affects also PostSharp.dll.

Concretely, you’ll probably have to do a global find-and-replace of import statements. I believe it’s a matter of 10 minutes to do the changes. I apologize for inconvenience. I think it’s better for everyone to do this small change now than to drag a debt during several years.

Breaking Changes for Everybody

The namespace PostSharp.CodeModel and PostSharp.CodeModel.ReflectionWrapper has been merged into PostSharp.Reflection. This has pretty low impact; the following find-and-replace will do the trick:

Find what Replace with
using PostSharp.CodeModel; using PostSharp.Reflection;

Breaking Changes in the Low-Level API

Basically, all low-level namespaces have been moved under the namespace PostSharp.Sdk. For instance, instead of PostSharp.CodeModel you will have PostSharp.Sdk.CodeModel.The same for most namespaces contained in PostSharp.Sdk.dll (the exception is PostSharp.Hosting, which is not considered a part of the SDK).

Other changes

  1. Added an aspect (ManagedResourceIntroductionAspect) that allows to introduce a managed resource
  2. Solved a race in the pipe client.
  3. Solved an issue where IAssemblyLevelAspect.CompileTimeInitialize is not invoked.
  4. Solved issues with the “Update Avaibable” warning.

Happy PostSharping – and thank you for your understanding.

-gael

Today happens to be my birthday. Since it has invariably happened every year for the last 32 years, this is no significant day. Expect that, 20 years ago, I was my 12th anniversary.

I became a teen and a geek at the same time.

I believe that every geek has a story to tell. A story about a passion. Here’s mine.

My First Computer Was a UNIX Server

My family was living in Kinshasa, Zaire at that time (1990).  School finished at noon, so we kids had plenty of time in the afternoon to enjoy an expat’s life. My father was IT director in the brewery Unibra. In Spring 1990, he ordered a department server for the operations of the company. The machine was supposed to serve many VT100 terminals.

When the package arrived, it turned out that it did not work. The computer itself was perfect, but the COM multiplexer did not work. Therefore, it was only possible to connect two terminals (one on each COM port) instead of a dozen. The computer was deemed useless and was to be returned to NCR for repair and diagnostic. I don’t remember if the computer came by boat or by air, but you can imagine that shipping a 30-kg high-tech box from US to Kinshasa and back is not cheap. So instead of having the machine sent back, NCR offered a good discount and my father could buy it for personal use.

This department server became my first computer. It had a 25 MHz 80386 CPU, 4 MB of RAM and 100 GB of SCSI disk. At that time, 8 MHz / 640 KB / 20 MB was still the norm on the consumer market, so I became the principal user of a very high-tech toy. Yet, the most amazing piece was not its hardware but its software: NCR Unix. A real 32-bit operating system (the first 32-bit OS of Microsoft, Windows NT, was first released three years later). A real multi-user and multitask system! The most amazing of all components was VP/IX, an MS-DOS emulation package for UNIX, which could execute multiple instances of MS-DOS inside “virtual machines” running in virtual 8086 mode. The UNIX file system was accessible through MS-DOS virtual network drives.

The BASIC Years (12-13)

I started my first programs almost immediately. Weeks before receiving the computer (even before I knew we would get one), I started writing my first program on paper. I think my teacher at school was happy about that: I was so busy programming during class hours that I had no time to disturb my classmates any more. The program was a memory card game written in GW-BASIC (the well of Microsoft’s fortune), adapted from a listing I found in the fascinating techie magazine Science & Life Junior. Since MS-DOS had no decent editor, I typed it in VI. Most surprisingly, it worked. Oh, maybe not the first day, but probably the first week.

I spent most of the afternoons of my 13th year programming, to great despair of my parents hoping some healthier activities.

I soon received the book “The PC Bible – System Programming” (probably a suggestion of my uncle and geek Francois Carlier), covering hardware, DOS and BIOS programming. I read it during a couple of hours every day in near-dark when my parents thought I was in bed (for my defense, I was in bed). At the age of 13, I probably had a complete understanding of PC system programming (it was, arguably, still an achievable task in system as small as MS-DOS 3). Tim Paterson became my hero, while other kids were playing football and discussing about pop stars I’ve never heard of. Bill Gates? Probably a businessman, not a hero of any kind. That’s what I still thought 2 years ago.

"With all the code being written out there, who gets the credit? People like Bill Gates get it all and he hasn't written anything in years!" – Tim Paterson, 1983

This big book was in French. But the UNIX documentation was not, of course. It’s something US geeks may easily overlook but… we other geeks had to learn computing from books written in a language we did not speak a word of! I eventually had my first English lesson at the age of 13.

I figured out that virtual 8086 mode is not cool enough, created a DOS boot floppy, a DOS partition, and let UNIX aside. In the process, I erased the partition table a couple of times. I wonder if my father was really angry, but when it happened for the third time, I was so afraid that I installed UNIX from floppy disks. At the age of 13, without knowing English. I could probably congratulate UNIX engineers.

My mother and kids were repatriated by the Belgian and French paratroopers during the so-called “October 1991 events”. We could take with us anything we could bear. Since the computer and the monitor were probably heavier than me, they staid. It eventually came back to Belgium by boat six months later.

Fortunately, I received some older “laptop” with two 3.5” disk drives and MS-DOS 5.0. I wrote my first commercial software there, a management tool for a school library (where I “invented” the bubble sort), sold 10$ to my uncle who was school director. This piece of software, written in 1992 by a 12-years-old kid, was still reported being used in production in 2003.

The C Years (14-16)

Very soon, I wanted to evolve from BASIC. So, Pascal or C? Pascal was for students, I thought, and C for professionals. So I learned C. Kids’ vanity is amazing – but armless, and driving. I got a copy of Borland Turbo C 2 from my uncle (I have to apologize today: all these copies were illegal!). I bought, this time, a copy of “Undocumented DOS” (Addison-Wesley, 1993), wrote the infrastructure for Terminate-and-Stay-Resident (TSR) program that was more stable than SideKick itself, then dropped the project because the funny part was done.

I played with Borland Turbo C++ 3 too, did some Windows programming, but never became an ace in OWL neither in Windows. Even today, my knowledge of MFC and ATL is very superficial.

The PowerBuilder Years (16-17)

My father maybe figured out that I should start doing something useful, and bought me a copy of PowerBuilder 4. I have still an enormous admiration for this piece of software and its companion, the amazing Watcom SQL. Productivity was really impressive compared to C++, and possibilities huge compared to Paradox (we had the Quattro Pro / Paradox package too).

Indeed, I started doing something useful. This is, again, a story of vanity.

My English teacher whispered me after some class: “Gael, would your skills be sufficient to develop a note-managing software?”. The question was so elegantly formulated that I could only jump into development. I did some analysis, I read Codd's rules of database design at this time. It took me the summer to deliver the first version. (Again - coding ten hours a day when folks were flirting or pursuing other activities typical to their age.)

This first was a catastrophe and a revelation. This is where I learned what a user is. I learned what a user interface is. I learned that users don’t care about what’s inside the box, they don’t even care about features, they want a tool that help them getting their job done. It took me another year to have it right. The software was used by a dozen of teachers during five years. It was a classic client-server application typical of the late 90’s, with a central Watcom/Sybase database. Teachers could work at home with a subset of data and integrate their changes to the central database by replaying the transaction log. I think there were reasons to be proud about this application: it was addressing a concrete problem in an efficient and reliable way. Teachers Jean-Luc Goffeau and Benoit Cordy, as well as the retired engineer Francis Lagas (I’m not sure I can still spell all names correctly), offered me a lot of help and support in this effort.

We did try, with Benoit and Francis, to sell our solution. We managed to have some interviews and demos with government officers and industrials. I was present in a contest for young programmers in Poitiers (as you can imagine, with such a boring application, I won strictly nothing). We did not sell anything. Even then, the reason was pretty clear: the system was too difficult and expensive to operate, requiring an SQL server in every school. It was before “Software as a Service”, and, as it happened, many internet-based solutions appeared in the 2000s.

The University Years (18-22)

University marks the end of the first act in my passion.

I was quite lucid I would make a career in computers whatever I study, so I chose to take a break. I studied engineering (“polytechnique”) at the University of Louvain, but I did a major in mathematical engineering instead of computer science.

Having spent most of my previous 6 years with computers, I do not regret this choice. I studied two minors in philosophy, took as much as non-engineering classes I could. Attended lectures the less I could. Drank lots of beers during my first 3 years and spending my last 2 years representing the interests of beer-drinkers to the university vice-rector Gabriel Ringlet, became one of the forest student negotiators, with a couple of achievements I never forget to narrate every time I meet a fellow student.

Yet, I hardly found time for programming. The only exception was the last year, where I wrote a hot strip mill simulator in Matlab (actually, Octave) with some parts in C. I learned Linux/Debian at that time, but never really felt in love for it.

The Dark Years (23-28)

I have always feared to get bored. For me, pursuing an an engineer’s career had no appeal, probably because there’s too much determinism there. So when I met my wife, it was not a difficult decision to move to Czech Republic. It was now or never – it’s too hard to cut lifestyle when you’re used to one, so it’s better to start with a low one just after study. So we did.

I was not disappointed by the difficulty of the situation I put myself into. I did not know Czech well at that time, and they seemed to ignore that I had the best technical diploma available (as we were repeated at faculty). I did not have any social network.

I was lucky enough to find a job in Newlink, a small Flemish web shop based in Prague. I soon figured out that the shop was too small and left after 18 months. In the meantime, I pushed ASP.NET 1.0 in the company.

After a couple of small iterations, my fate got into the hands of Adastra, a consulting company – I now call that a body shop. They sold me to Oskar, a mobile telecom operator, where I was asked to code business processes in PL/SQL. I became fairly good in programming large Oracle databases, and discovered that just the scale makes an apparently trivial problem much more difficult – and interesting – than expected. Then I became a TIBCO programmer, which gave me a good insight on distributed architecture.

I learned important things in Oskar. I learned professionalism. It’s shocking to program a telecom offer, know it’s being released during the night, then the next morning see the billboards in the street. No right to error. No right to delay.

I lived the metamorphosis of a startup (Oskar) into a corporate (acquisition by Vodafone). It was stunning to see how the cost structure was steadily increasing, the efficiency of the IT department constantly decreasing.

I have enormous respect for the tools developed by my predecessors and superiors Filip Kubec, Jakub Adamczyk and Karel Kalivoda during the early days. They were of an elegant simplicity and solved the problem they addressed. I have much less admiration for the culture of bureaucracy, sycophancy and machismo that progressively replaced the “agile” culture of the first days.

These 3 years spent in Oskar then Vodafone were synonyms of frustration. My political failure was almost complete. I could not accept this culture where everybody had to lie (by filling in false information in timesheets) to protect the career of our directors and VPs. I have never been able to work with yes-men, neither to shut up when witnessing technical aberrations. Yet, with some years back, I think we managed to achieve some good work given the rotten environment we had to work in.

It was the time I started to write PostSharp in my spare time.

I have already written about the history of PostSharp itself and the objectives I had when starting the project.  One of these reasons is that I got the impression – right or wrong – that I stuck again with career determinism. Having understood how “consulting” works, I saw no bright perspective for a Belgian programmer in Czech Republic. All desirable career paths – as I perceived them at that time – were blocked due to my still-non-perfect Czech and, probably more than I admit, my lack of sense for political compromise. PostSharp was due to raise my international visibility and get me out of the rabbit hole I got into.

I eventually left Vodafone in Spring 2007 with an indemnity which allowed me to start as a freelancer.

The Freelance Years (29-30)

My objective during this period was to consult 60% of time to have 40% of time available for PostSharp. It supposed I could invoice 165% of the usual consulting rate in Czech Republic, which I have been able to achieve most of the time.

I first contracted for Good Data in their very early days during 3 months. My only objective was to work with the serial entrepreneur Roman Stanek to see and understand how a start-up work. Without knowing why yet, I though this guy was good to know – indeed, he became an investor in SharpCrafters 2 years after. I was ready to everything just to learn out something about the business of software.

Yet, the rate did not allow me to reach my 60-40 objective, so I started working on a regular basis for Starcounter.

I spoke at several conference and user groups in Europe during this time. PostSharp made huge progress. I could stabilize and release PostSharp 1.5. Yet, I found out that 40% of paid time was not enough to maintain and develop the software. After an unsuccessful attempt to sell support on PostSharp (still released as OSS), I came to the conclusion that I needed to make it a fully commercial product.

SharpCrafters (31-?)

The development of PostSharp 2.0 started in March 2009. It took more than one year to build the product and the company behind it.

Spring and summer 2009, when I designed and prototyped the aspect framework of PostSharp 2.0,  was a period of extraordinary creativity. The abstractions behind what you can see in PostSharp.dll are brilliant; the idea to use graph theory to address aspect composition was innovative. There’s probably no achievement I am more proud of than this aspect framework, written in 3 months (then tested in 6 weeks and stabilized in 6 months…).

Today, PostSharp 2.0 is technically completed. Customers started to buy it. Cash flow is positive. Now I have to build a team that will further maintain and develop PostSharp, and create other products. A fully different story.

Taking Great Hackers Out Of Corporates

Why productivity sucked so much in Vodafone remained an enigma for me till very recently. Why was I so bad there and so great here? During a couple of years, my explanation was bad management. There was a bunch of talented people there, but they are strangled by bad management, stressful environment, and rotten culture. Lately, I have been proved wrong and naive. Management may explain a difference of productivity of 30%, not of 500%.

I now believe I severely underestimated my own talent. It’s not that people in corporate are bad; they were actually pretty good in Vodafone. There may actually even be gems in corporate, as I and probably other were. The problem is that corporate environment gums differences in technical talent so that nobody can make the difference between a good programmer and what Paul Graham has called a Great Hacker. Since great hackers don’t stand out (or even underperform, as I did), “just” good programmers look comparatively better than they actually are. So you won’t make a great start-up team out of programmers who were “just” good in corporate environment. Only great hackers, those who underperform in corporates, may multiply their productivity in a different environment.

It’s only lately, by reading books on the software of business by Spolsky and Wink, that I realized I was a great hacker and could be proud of it. Before that, I only thought I got some abnormal teen age and I never mentioned that I wrote my first program at the age of 12. Yet, now, it’s the first question I would ask to any candidate.

Between Talent and Pathology

I once attended a conference about psychoanalysis at university, and the lecturer told something I will always remember: psychopathologies are common in normal life; most of the time, psychopathologies positively translates into a choice of profession. Sadist can be great doctors. Melancholic can be great musicians. Only exceptionally does a pathology translates into a criminal or suicidal behavior.

Are great hackers psychopaths? I think so. Any talented artist, crafter, scientist, doctor, teacher, anyone who devotes himself to his profession obsessively enough to become great, must have some psychopathology.

A psychopathology is something you’re born with, or you are taught by your parents when kid. In one way or another, you inherit the pathology. You can’t choose. The only thing you can choose is how you will use that pathology: will you strangle it and become average and frustrated, or will you unleash it and become talented?

Looking to my near family, I can clearly see points converging to me. From the 4 boys of my father’s family, two excel in obsessive activities (one is champion of Scrabble and the second builds family trees going back to centuries), and three are entrepreneurs or freelancers. From the 3 girls of my mother’s family, 2 have contemplative activities, their father is a PhD and his brother was the rector of a business university. You have all the ingredients converging to PostSharp: a 5-year obsessive, highly intellectual and entrepreneurial effort.

Fortuity? I don’t believe so. Pathology turns into talent just as caterpillars metamorphose into butterflies.

Summary

This post was exceptionally long; I probably violated all rules about blogging, starting from: not talk about yourself. I hope I have been able to communicate reflections that are not specific to myself and, hopefully, will resonate with what you’re living every day. Next time in 20 years. Please apologize me this one.

I am pleased to announce PostSharp 2.0 RC 1, available for download today. This is a real release candidate: it could be promoted to RTW if community’s feedback is good. The last CTP proved very stable (only a couple of major bugs have been reported), so I am very confident with this RC.

People, now it’s seriously time to migrate from PostSharp 1.5 to 2.0. I’ll blog about it next week so you won’t have any excuse!

What’s New in this RC?

  • Documentation!
  • Fixed support for Code Analysis (FxCop)
  • Easier configuration using files PostSharp.Custom.targets.
  • Streamlined license configuration and checking.
  • Happy Monday. Users of the community edition will figure out next Monday.
  • Add methods GetValue/SetValue to class LocationInfo
  • SDK: support for moving declarations from one parent to another

Bug Fixes

This release fixes the following issues:

  • MethodInterceptionAspect: local variables not visible in the debugger    
  • Native host: access to AssemblyReferenceList cache should be synchronized    
  • Support for assembly key revocation    
  • The MSBuild task should clean the license key before adding it to the command line    
  • ImportMemberAdvice may import the wrong implementation if Order=AfterIntroductions   
  • EventInterceptionAspect does not work for delegates returning a value   
  • Possibility to move a declaration from one parent collection to another    
  • AssertionFailedException in InstructionBlockBuilder    
  • GUI feature allowing to disable the evaluation period expiration message    
  • OnMethodBoundaryAspect throws InvalidOperationException    
  • PathTooLongException thrown during license checking    
  • Reference assemblies passed through file name (not directory) are not found   
  • MethodExecutionArgs.Method is set to the generic method definition instead of the generic method instance   
  • Optimization of OnMethodBoundaryAspect may cause unwanted sharing of MethodExecutionTag    

What’s Next?

I consider my job is done with PostSharp 2.0. I’m confident I’ll publish the RTW in early July. I should be able to provide hot fixes very quickly (even next business day) during the next 30 days.

Now that the product is finished, it’ll be time to temporarily remove my programmer’s hat and focus on two essential activities: marketing and hiring. If you know a sharp crafter, I want to hear from him :).

Happy PostSharping!

-gael

There are tasks you never know when you are done with. Documenting a complex API is one of those. I spent the last 6 weeks working on PostSharp 2.0 documentation, and it seems like I could spend another month on it. Yet, I think the result is already better than good enough – it’s actually pretty good. It’s available online here:

http://doc.sharpcrafters.com/

Note that the documentation refers to the last hot fix (1266+). Some features or APIs may not be available in the last CTP.

Inside the Book

The documentation is structured in two principal parts: deploying PostSharp, and developing with aspects.

The first part starts where the setup program stops: development environment may be very complex; deploying development tools to a large team may be very challenging. This chapter is based on my experience of supporting customers during last months. Special thanks go to Roy Osherove of TypeMock, who patiently went through all imaginable problems. His feedback prompted me to make deployment easier and to seriously document it. Thanks to all folks who reported issues or simply questions on the forum.

The second part is about aspect-oriented development itself. If you thought you knew everything about PostSharp, read this chapter. This is where you can contemplate the robustness and consistency of PostSharp 2.0 design. It’s elegant. Intelligent. Well-crafted. I’m proud of it.

Credits

Apart from Roy mentioned above, I would like to express my gratitude to two projects and the guys behind:

  • Eric Woodruff’s Sandcastle Help File Builder (SHFB) is wonderful. I deleted my 4-years old Sandcastle custom build scripts and switched to SHFB in a couple of hours. Writing content in MAML rocks. Thank you Eric for this excellent work!
  • Help Server of X-tensive.com is a superb product. You can judge by yourself on http://doc.sharpcrafters.com/. It’s a commercial product, but it’s definitively worth the money. Thank you Alex and team!

What’s next?

The documentation was the last big task to complete before the release. The rate of bug reports has dramatically decreased since the last CTP. So you can expect the RC very soon, hopefully next week.

Note: If you are still using PostSharp 1.5 and are not registered yet on our web site, do it now. Once PostSharp 2.0 will be RTWed, PostSharp 1.5 won’t be available any more for new users.

Happy PostSharping!

-gael

Do you know how PostSharp is popular in your region? I just put online a map showing the number of PostSharp users per square inch in the world.

Density of PostSharp users http://maps-sharpcrafters-com.s3.amazonaws.com/users-2010-04/googlemaps.html

(I don’t give you absolute number of the color scale – I don’t know it myself -- so you can think the number-of-users-per-square-inch is a relevant unit.)

How I built this map

The map is constructed from web server logs, but I find it much more useful than anything I could see before. Google Analytics construct map overlays by drawing circles of different radius; since these circles largely overlap, it’s very difficult to get an idea of the real distribution of users.

This map has a strong mathematical foundation: it shows the Gaussian distribution of users in the world.

I used the following steps:

  1. Start with IP of users, visitors, …
  2. Map the IP to a geo location using GeoIP Free.
  3. Associate each IP with a Gaussian distribution. Choose a small radius for precision, larger to see trends (here it’s pretty large). Note that computing the distance of a point from another, given their longitude and latitude, is not trivial.
  4. For each point on the map, sum all distributions, then normalize.
    This results in a function [-180,180]x[-90x90] –> [0, 1].
  5. Map the value to a color/opacity space, store it as PNG.
  6. Use MapTiler to generate an overlay for Google Maps.
  7. Upload it. I’m done.

Interesting findings

The proportion of PostSharp users is of course highly correlated to the demographics and the economics of the area itself. So the density of users in Europe is higher than in the USA, but there’re still more users in the USA than in Europe.

The map shows peeks in London and Taipei; Netherlands have a lot of PostSharp fans too. Germany has large areas of average densities, which suggests that German software development is less concentrated in cities than in other countries. A good thing. New-York is the home of may PostSharpers too. I would have loved to see a peek in Seatle, but…

Two deceptions: France and Japan.

And one good surprise: Bermuda.

Folks in Bermuda, I am offering you 1 week of free consulting – just pay T+E :).

Enough. I still have to finish the doc and finish 2.0.

Happy PostSharping!

-gael