Sunday, August 21, 2011
Here's an interesting project I came across:
The game is Mastermind, which many people already know. What caught my attention is that it's done in C++ and XAML. To quote Tyler Whitney's blog post
The Mastermind code sample demonstrates how to create a simple Silverlight
storyboard in Expression Blend 3, and then provide the code for the state
transitions in Microsoft Visual Studio 2008. You can also see how to create
brushes programmatically and how to add a title bar to a Silverlight-based app.The code
is on the Microsoft Code Gallery (only Microsoft Employees can publish there) and Tyler has been updating the article over the summer. Nice way to see how to combine two technologies some people would never thought have combining.
Friday, August 19, 2011
I have talked about plenty of C++0x (soon to be known as C++11 or just plain C++) features over the last little while. Here's a nice summary by Danny Kalev
of the top features and why they matter. He covers lambdas, auto, the new ways to initialize instances (which hasn't been covered much elsewhere and contribute a lot to readability), suppressing default versions of functions (like constructors for example) or specifically requesting them (how cool is that?), nullptr (which I love because it eliminates a late night drinking argument about "what if someone #defined NULL to 3, would your code still work?", and rvalue references -- and those are just the language changes! His library coverage is super terse, but there are links in it if something (*cough* shared pointer *cough*) catches your attention.
There's no reason for a C++ developer to ignore C++11. This is big stuff, and reading these "what's new" lists from a variety of different people is essential for getting perspective on the changes. So read Danny's list!
Wednesday, August 17, 2011
Everyone knows that C++ is the language to use when speed matters. That's just a known fact. So here's a question: if you solved the same problem in both C++ and C#, using the generally available languages (the Standard Library for C++, the .NET Base Class Libraries for C#) and you didn't happen to know which parts of those libraries weren't implemented very efficiently, just wrote your apps -- which would come out faster and by how much?
Think you know? Of course, the answer is "it depends". Debug or Release builds? Laptop or handheld device? Whose implementation of the .NET Framework are you going to use - Microsoft or Mono? What chip are you running on? Oh, and to what extent are you deliberately setting C++ options that emphasize runtime speed? Also, did you choose an algorithm with a lot of generics or templates? C++ has a huge perf advantage there, but lots of benchmarks don't use generics or templates since they are solving one specific problem.An article on CodeProject
leapt into all of this feet-first and did some measuring. Along the way, "Qwertie" proved a universal rule of the internet: nothing will get you the answers you seek faster than posting the wrong answer. Want to know the exact date Bewitched switched Darrens? Find a place that discusses old TV shows and post your belief that there was only one, or that there were seven, or whatever, and people will correct you while the ads are still loading on their copies of the page. When Qwertie posted the first version of the benchmarking article, commenters were quick to say "but you made this mistake, and that mistake, and forgot this other thing" all of which led to a much better article.
Definitely worth a read. It gets you thinking about the things that truly affect performance. Absent-mindedly deploying a Debug build is going to cost you far more performance than your language choice ever will. Using a library in a performance-sensitive situation without understanding whether the library is high-performing or not will too. It's chock full of graphs like this one:
Don't read it to find out the answer to "is C++ faster than C#?" - we already know that. Read it to find out how to make your applications faster.
Monday, August 15, 2011
Months ago, I tweeted "Once you have a hammer, everything looks like a nail" with a link to an interesting article
about the times you shouldn't use System.DateTime.Now - sure, you know how to use it, but it's not always the right tool for the job. Keyvan Nayyeri provides a number of alternatives for .NET developers who want to know when something happened, or how long something took. Definitely worth a read.
Then just weeks after that, Susan Ibach gave the SQL side of the story with a blog post
about avoiding the DATETIME type if you're using SQL 2008. I saw the headline and thought "what? what else would I keep a date or a time in?". The answer is, either something smaller or something with more precision. Makes sense.
Goes to show, just because you've heard of System.DateTime in .NET or DATETIME in SQL doesn't mean there's no other way to solve your problem. Keep learning!
Saturday, August 13, 2011
When I provide links from this blog, I don't shorten them. When I get a link in an email, I always hover over it to see where it leads, in case it's a phishing email. But when someone emails you a shortened link, or tweets a shortened link, how do you know where it leads? It might be a phishing link. Or it might just be that cat video you've seen too many times already.
Years ago, Joshua Long wrote up a summary of how to see where a shortened link goes
before you click it, and he's been updating it pretty regularly. He covers TinyURL, bit.ly and its relatives like on.fb.me, goo.gl, is.gd, and many I've never heard of. There's even a site you can paste a shortened link and get back what it redirects to. Not all links will be worth this treatment, but many will. It's nice to have a summary of how to check them before you follow them.
Thursday, August 11, 2011
I'm pleased to see that Kenny Kerr is writing his C++ column for MSDN
again. He's also blogging again and in a recent entry
, he provides some really plain-spoken advice to people looking for guidance:
- "You can of course still use MFC but I do not recommend it as modern C++ can do
a better job of supporting the Windows developer."
- "You should never again use auto_ptr for anything."
So there! I agree with these, especially the auto_ptr one. It was an attempt at a smart pointer that just wasn't smart enough. We have shared_ptr and unique_ptr now and they work in collections and are truly smart pointers. Use them and stop typing delete in your code entirely.
As for MFC, it does fill a need and I certainly wouldn't scrap a working MFC app just because the library is getting old (the facelift a few releases ago helped) but if I was starting a brand new application from File, New Project I would need a good reason to use MFC as my UI framework.
Tuesday, August 09, 2011
People often ask me what Visual Studio Ultimate offers that other versions do not. There's a handy chart on the Microsoft site:
The only problem is, if you don't know what "Architecture and Modeling" includes, it's easy to think there's probably nothing useful in there. So I was pleased to see a blog post by Susan Ibach from Microsoft Canada showing how easy it is to generate a sequence diagram from code, and how that can help you understand code you've inherited from a predecessor. That's one of the diagramming tools included in Visual Studio Ultimate.
Right click in some code, select Generate Sequence Diagram, set some options (does getting a property count? What about calls to methods of String or other .NET Framework classes?) and presto, you have a sequence diagram.
This sort of thing can save you a tremendous amount of time, and that means it can save your organization money. That's why some people buy Visual Studio Ultimate, after all. Having access to a tool like this is one of the ways I can "hit the ground running" when I join a project. If you need to do the same, make sure you're not ignoring a capability you already have.
Sunday, August 07, 2011
Like a lot of people, I got started on Facebook one way, but now I use it another. And like a lot of people, I haven't quite "cleaned up" from my original start. My rule these days is very clear - Facebook friends are actual friends. People I know and like. In fact, my rule is that we should have shared a meal - ideally a meal and some wine - to be friends on Facebook. If we worked together, or presented at the same conference, and we actually enjoy each other's company, chances are we went for dinner, or lunch, or a beer, at some point. It's a handy rule that makes my decision process easy. I get friend requests all the time from people I don't know, and I just ignore them.
With that audience, my Facebook posts can be pretty personal. What my kids are up to. Pictures of my family and my holidays. Details about travel plans, including whole-family trips that leave my house empty. Sure, I know that what you put on Facebook can be forwarded and shared elsewhere. But I know who I'm sharing with and I trust them to have my best interests at heart. I don't connect my Twitter statuses (which I know are public) to my Facebook ones (which are more private and less frequent) or vice versa.
What I've set up, for people who use Facebook as a news hub, is a public page
. Here I post when I'm speaking somewhere, or when a video or article is published. If you "like" this page, my announcements will end up in your news feed. So if you added me on Facebook and never heard back, use the public page instead. I don't post links to all my blog entries there, because I figure you can always subscribe to this RSS. I don't post anything personal either, so if you don't actually care where I'm spending my holidays, you might want to like that page even if we're already Facebook friends.
© Copyright 2024 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Saturday, March 02, 2024 6:15:31 AM (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial