Categories
.net c# cpp iola Programming

C# from a C++ developer perspective

Been wanting to get this out of my system for a while and since I can’t sleep I might as well do something productive.

During my time in iola I’ve begun writing code in C#. I’ve written quite a lot of C++ in the past and still does, so it was quite interesting for me to see what the next iteration of C would be like when I started out with this. This next section is written in a very practical sense, since at the end of the day, that is really what matters.

The nice stuff:

  • Fast compiler. I really think this is big. The slow compile time in C++ is contributed by several things, templates are really big here. And since they need to live in header files changing them can easily trigger a cascade effect of recompilation that is extremely detrimental to the whole coding experience. There are hacks around this but they are not really optimal solutions. When I did almost all my coding in C++ I didn’t think of this as a big problem, but once you’ve been seduced by the dark side (Take that Siebel ;-)) you really start to notice it a lot. And the fast compile time of C# makes it much more bare able to write in a statically typed language again.
  • Portable library with a lot of useful stuff like threading, network communication, File System abstraction, serialization etc.
  • No more dreaded header files. While this may seems strange at first (since header files are a nice way of describing the interface of the classes with comments that don’t get lost in the smoke of implementations), it’s actually really nice not having the headache of keeping
    the header files in sync with the implementation, making it much easier to move code around. Another big thing here is the whole template thing.
  • Delegates (or function pointers if you will) are extremely powerful and having them built into the language makes them very easy to use.
  • Support for yield.
  • Being able to use the power of .net (Newer in a million years thought utter such words) to mix and match languages. It’s actually quite trivial to write a piece of your program in Boo and have it work with the rest of the code. This is in particularly useful for writing unit tests.
  • Perhaps the biggest improvement, although this varies greatly from ones perspective, is that the whole language raises the bar. In the sense that a lot of the BAD programming practice that has been associated with C++, mostly caused by people simply using the language in the wrong way (char pointers, not taking care of memory management, generally pointers comes to mind here) has been stripped away from the language. A really good example of this is to compare the abomination that is pre .net C++ windows code and .net C# code.
  • C# is constantly improving and is doing so quite rapidly. Compared to the extremely slow pace of C++ (still hoping for a new standard in this decade!) it’s really refreshing to see a lot of good new ideas being pushed out to people.

The bad stuff:

  • Two thumbs up to the designer of C# for stepping up and actually implementing generics in C#. That being said, they are just a shadow of templates in C++ and the whole I-Implement-an-Interface crap is just plain dumb. Templates in C++ compared to generics in C# feels much more like macros in lisp, which if one thinks about it is quite the irony.
  • C# is clearly very proud of their garbage collection and thus sees no problem in demanding that everything must be created using the dreaded new syntax. While writing something like: List<string> l = new List<string>(); is not that big of a problem in something like monodevelop or visual studio. But it’s a big pain in the ass if you’re using the one and true editor. Another thing related to the GC is that needed to invent new syntax (using) to support the good programming practice of RAII instead of just doing it by creating objects on the stack and letting them fall out of scope and thus become deconstructed automatically.
  • C# falls into the trap of thinking that everything must be an object and that object orientation is the true path to righteousness. Namespaces was invented for a reason you know?
  • The built in libraries and especially the documentation is sometimes really really bad. Like methods returning results in different threads than the caller and not writing anything in the documentation about this.

Overall the experience so far has been quite positive and as far as I can see it will only continue to improve. That being said, there are still use cases where C++ is much more optimal and combined with a lot of legacy code C++ will continue to be used for a foreseeable future.

Categories
fowa iola

Future of Web Applications postmortem

FOWA is now over and it has been a great conference. On the way back in the plane I got to thinking that almost all the new web applications work a lot like open source projects. In the way that they are first and foremost open, encourage external contributions (using API´s), encourages the users to drive the development of new functionality, and are actively encouraging feedback from their users in an open way where users can help other users solve problems.

Categories
fowa iola

FOWA day 1

Day one was really great. A lot of awesome talks. The most interesting guy was perhaps Umair Haque talking about edgeeconomy.  I havn’t  heard the economic  perspectives of open  distributed  production, really interesting. Steve Souder showed a very nice tool called Yslow, that can really help you find speed bottlenecks in your web apps. Anyway next up is Paul Graham so I better stop here 🙂

Categories
iola Personal

Future of Web Apps

I’ll be attending the Future of Web Applications next week. The conference seems to have quite a few interesting talks, I’m particularly looking forward to hear Paul Graham talk since I enjoy his writings immensely.

Categories
Free Software Hacking iola

Creating nice and clean patches

I was creating some patches for tracker today from a rather large amount of local changes which was nicely filtered together. Some source files had several independent changes that I wanted to extract and submit as a single patches instead of one big megapatch. So I looked around and found out that the OO guys have created a script to do exactly that. It takes as input a regular expression (the script is created in perl so one gets the nice regular expressions from perl) and a diff and spits out a clean diff + the rest of the changes.

Categories
Books iola On the web

.random

I stumbled upon two  articles by Paul Graham. Interesting tips for startups.

Interesting blog with a some thoughts on wikipedia and software in general.

Lessig’s Code version 2 is out. Will be interesting to see what has changed.

Categories
Books iola marketing

Purple Cow

I finished reading the first marketing book, Purple Cow. The book is truly remarkable and gives a lot of food for thought. He gave a talk at google about the subject, which also brings up some extra points. It’s a good teaser for the book but I think one will appreciate it even more if one has read the book beforehand.

The purle cow?

Categories
iola Personal

New home for my homepage

My normal homepage has now been relocated to the iola domain. I also updated the information on it a little bit. The old domain should work until about end of January 2007. This blog will for the time being stay at the same location. Be sure to update your bookmarks in time 🙂

Categories
Books iola marketing

Marketing books

While working on a business plan for our project at iola, it has become apparent that none of us have a good deal of relationship with marketing so I have been looking around the net for some tips/books. In my so far very limited study I have found a list of recommended books from Martin Thorborg (sorry the reviews are in danish, but the books aren’t). If you know any good ones please don’t hesitate to either write me or write a comment 🙂