Brad Abrams was a founding member of the .NET common language runtime team way back in 1998. He's also the co-author of many essential books on .NET, including bothvolumes of the .NET Framework Standard Library Annotated Reference. I was at a presentation Brad gave to the Triangle .NET User's Group early in 2005. During the Q&A period, an audience member (and a friend of mine) asked Brad this question:
In case you were wondering what Brad is doing these days, Brad has moved up and on from the .NET CLR team. He’s currently the group program manager for the UI Framework and Services team. His team owns ASP.NET, Atlas, and Windows Forms.
Super, super nice guy. And one of the best MS blogs out there too:
I used to like String.Format before I discovered Ruby. The {n} thing is OK until n becomes a reasonably large number (5+/-2). Then it becomes a lot harder to read.
String.Format(“My name is {0} {1} and I’m a {2}”, firstName, lastName, citizenship)
vs.
“My name is #{first_name} #{last_name} and I’m a #{citizenship}”
Java and .NET String are both a big step up from C and even from C++'s std::string, but are still fairly primitive tools compared to the string capabilities of dynamic “scripting” languages like Perl, Python, and Ruby. So its important to keep things in perspective.
String concatenation is still useful over string.format because it is an order of magnitude faster! string.format may be easier to read, but the performance difference can really show in a tight loop. Try it!
To John Lam… you have the same type of inline syntax in PHP, and I’m sure a few dozen other languages. Ruby is great but that feature is far from unique.
Oh, and I think a sealed Strings class is great. There is nothing more annoying than having to maintain someone else’s code and seeing a class that you think you know how works but you don’t, because it’s a funky inherited type of a base system class and they’ve overridden half of it. Blench.
Aye, I have to agree strings are wonderful, but concur with Nick. Its Sealed! This is OO days, we want to inherit and extend that functionality, not be told we can’t. Sealed, in this instance, is taking a big step backwards in my opinion.
From all I’ve heard String.Concat does perform a bit better than String.Format and a lot better than “a”+“b”+“c” for patching together long strings. Obviously String.Format has it’s own advantages in many cases but if you just want to tie a bunch of strings together concat is a good option.
It’s not any different, it just supports a zillion more output formats. Unfortunately, it doesn’t support named value key/pair substitution as shown in Ruby and PHP via previous commenters…
Not all of us are from the C/C++ world. I personally use Delphi.net, and I personally think OO inheritance is a great option/tool.
Just because some people love operator overloading doesn’t mean you should remove the ability to inherit from that base class. Personally we can extend a class (yes I use different names for my new classes, but I know what you are talking about) to provide more then just the base class offerings.
There are plenty of times I’ve wanted to extend from a class in .NET and been denied the means, because it’s sealed. Personally I think sealed has its place, but it seems a little overused currently on some classes in the framework.
Shawn Oster said
To John Lam… you have the same type of inline syntax in PHP, and I’m sure a few dozen other languages. Ruby is great but that feature is far from unique.
PHP has an inline syntax, but it’s quirky and error prone, Ruby’s inline syntax (some other languages have that kind of syntax indeed) is cleaner and mostly error-free.