Some great jargon over at http://www.globalnerdy.com/2010/05/09/new-programming-jargon/. My favorite is “Yoda Conditions” — things like “if (5 == count)”
Some Good Guidelines for Writing Unit Tests
May 2, 2010This post not only covers some good guidelines, but why they’re important.
Kent Beck Talks About Agile for Startups
April 27, 2010I thought this video was worth watching. Nice compare-n-contrast between the way things were done before Agile, during Agile in established business, and Agile for a startup. One thing that stuck with me is the story about a situation where the question was “will people buy the for-pay portion of this product?” Answering that might drag people into the “oh man, we need to build a payment gateway, etc. etc.” … well, why not just build a “buy button” where it opens the second half of the product and lets the product owners know that someone pressed the button — even though that makes it free for those people. So what? You’ll learn whether people will pay for it.
Crucial RealSSD Tested
March 26, 2010Some not-so-good news for the SSD drive I was keeping my eye on: http://www.anandtech.com/storage/showdoc.aspx?i=3779. Their drive died after some use and there’s some very serious performance problems after enough data has been written to the device. Here’s hoping Crucial fixes the problem and AnandTech testing that all is well…
Dynamic C#
March 21, 2010So I installed VS2010 RC and am reading some books… and came across a demo of the new “dynamic” type in C# 4.0 that I thought I’d share …
The Basics
[TestMethod()]
public void BasicDynamicTest()
{
dynamic f = Activator.CreateInstance(Type.GetType("System.Text.StringBuilder"));
f.Append("Hello");
f.Append(" World!");
Assert.AreEqual("Hello World!", f.ToString());
}
The type of f is is determined at runtime. You might be wondering why you’d want to do something like the above. You might start thinking about evaluating expressions at runtime, a la scripting or dynamic languages like Python or Ruby. How about something even more clever, like defining the structure of an object at runtime?
DynamicObject
To do so, you need to create a class that inherits from the DynamicObject class and then you can do things like override the TryGetMember method so you can create your own methods on the class at runtime:
// First, make sure MyXML inherits from DynamicObject
class MyXML : DynamicObject
{
private XDocument _xml = new XDocument();
// Simple constructor
public MyXML(string x)
{
this._xml = XDocument.Parse(x);
}
// Let's dynamically create our own methods
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
string nodeName = binder.Name;
result = _xml.Element("top").Element(nodeName).Value;
return true;
}
}
[TestMethod()]
public void MyXMLConstructorTest()
{
dynamic xml = new MyXML(@"
<top>
<node1>Alpha</node1>
<node2>Beta</node2>
</top>");
Assert.AreEqual("Alpha", xml.node1);
Assert.AreEqual("Beta", xml.node2);
}
Drawbacks?
While you can basically do this with Reflection, dynamic code is much easier to deal with. You lose Intellisense on dynamic types, compile-time checking, and performance. The DLR (Dynamic Language Runtime) does the runtime interpreting for you. As the author of the book that I’m reading states, you generally wouldn’t want to use dynamic code except where you’d otherwise be using reflection; C# by nature is statically-typed so most of the time, you’re better served by writing static code.
Incidentally, the C#/.NET 4.0 book I’m reading (1 of 3) is Introducing .NET 4.0 With Visual Studio 2010 by Alex Mackey. I haven’t gotten through enough of it to have a firm opinion but I picked it up because I liked the sharp and tight focus on things that are new in 4.0 as well as the focus on MVC 2 and jQuery (there looks to be some nice interop there).
Crucial (Micron) RealSSD C300′s for Sale!
February 25, 2010I’m so tempted to buy one of these new ridiculously-fast SSDs and break out of the 64 gig limitation I currently have.
9 Tactics for Rapid Learning
February 21, 2010I found this to be an interesting list of things to think about using to improve how well you retain information or how quickly you learn.
Cultivate Teams, Not Ideas
February 17, 2010I really like this post. FTA:
I wouldn’t call ideas worthless, per se, but it’s clear that ideas alone are a hollow sort of currency. Success is rarely determined by the quality of your ideas. But it is frequently determined by the quality of your execution. So instead of worrying about whether the Next Big Idea you’re all working on is sufficiently brilliant, worry about how well you’re executing.
If you give a good idea to a mediocre group, they’ll screw it up. If you give a mediocre idea to a good group, they’ll fix it. Or they’ll throw it away and come up with something else.
Visual Studio 2010 RC Released to MSDN Subscribers
February 8, 2010I’m downloading it now. At 4 MB/s!
http://www.neowin.net/news/microsoft-visual-studio-2010-rc-released-to-msdn-subscribers
Crucial RealSSD C300 256GB SATA 6Gbps SSD
February 6, 2010New Super-fast SSD drives reviewed! 355 MB/s read, 215 MB/s write. “Only” $800 for the 256 GB drive (a bargain in my eyes, considering I dropped about that much for my 64 GB Intel SSD).
Posted by Ben Goodwin