Sunday, 10 December 2006
The title isn't mine, it's Charles Petzold's, and I would be quite surprised if you didn't learn things about C++/CLI just by learning things about the .NET Framework. In other words, you don't need to plan to switch to C# to get some benefit of this free e-book. It was originally supposed to be a chapter, but ended up over 250 pages long.
I know people still need this material. I have a new mentoring client with an established team of C++ developers who are just looking at moving to the .NET Framework. I came and did a "what is .NET" talk for them, with diagrams like this:
If you already recognize these pictures and realize what they are supposed to illustrate, then you don't need the e-book. But if you haven't really paid much attention to the .NET Framework, then this is a fairly painless way to learn a lot of it. The thing is, it's all C#. My suggestion to you is to bear with that -- a C++ programmer can read C# without too much difficulty -- and then come on back here to see how to do the same things using idioms you already know and love, and how to drop back into native code any time you like for various reasons include control over your application's performance.
Saturday, 09 December 2006
I was just looking at some old-style MC++ to convert a sample into C++/CLI. I had to convert this sort of thing:
public __gc class PostCodeChecker
virtual String* Check(String* code)
String* error = S"OK";
Boolean Test(String* code)
Boolean ret = false;
String* error = Check(code);
ret = true;
Into this sort of thing:
public ref class PostCodeChecker
virtual String^ Check(String^ code)
String^ error = "OK";
Boolean Test(String^ code)
Boolean ret = false;
String^ error = Check(code);
ret = true;
This is pretty mechanical work and just the sort of thing you might like to hand off to a tool. The VC++ team has been working on one, but it hasn't been a top priority. Now they've decided to release it as-is to those who might have some use for it, rather than holding onto it until it's perfected:
To set expectations correctly, the tool was going to be a “help” rather than a complete solution and in the push to complete other projects the tool was never fully completed, tested or documented. We are happy to release the tool “as is” as a few initial tests with external users have shown that they received benefits from using the tool even if: 1) it does not provide complete translation between the two different syntaxes and 2) manual modify of the outputted source code is still required to complete the conversion. The tool does come with source code so that users who wish to modify or extend the functionality to better suit their code bases can. The tool is totally unsupported by Microsoft.
If you have some oldstyle Managed C++ to convert, why not see if it can help you? It's a 5 meg download.
ps: one of the side effects of the more readable nature of C++/CLI is that after the mechanical work was done I just had to do this:
Boolean Test(String^ code)
Friday, 08 December 2006
Do you read Raymond Chen's blog? You really should. Like so many of the blogs I read these days, it is also going to be available as a book.
Luckily, I found a sympathetic ear from the folks at Addison-Wesley Professional who were willing to take a chance on my unorthodox proposal. But I caved on the length, bringing it up to 500 pages. Actually, I came up with more like 700 pages of stuff, and they cut it back to 500, because 700 pages would take the book into the next price tier, and "There isn't enough of an audience for a book that big!"
Eighteen months later, we have The Old New Thing: Practical Development Throughout the Evolution of Windows, following in what appears to be the current fad of giving your book a title of the form Catchy Phrase: Longer Explanation of What the Catchy Phrase Means.
It's a selection of entries from this blog, loosely organized, and with new material sprinkled in. There are also new chapters that go in depth into parts of Win32 you use every day but may not fully understand (the dialog manager, window messages), plus a chapter dedicated to Taxes. (For some reason, the Table of Contents on the book web site is incomplete.)
Oh, and those 200 pages that got cut? They'll be made available for download as "bonus chapters". (The bonus chapters aren't up yet, so don't all rush over there looking for them.)
This is a kind of trend really - many writers have put energies into blog posts instead of books, only to look up and discover that some of the posts, rearranged into an approrpriate order and with a little writing to connect them, make a pretty cool book. It's not clear whether it will be out in time to ask for it as a Christmas present, but it would be a cool way to use any booky gift certificates people give you.
Thursday, 07 December 2006
In Barcelona, I was on the panel for the Barcelona Girl Geek Dinner. Now, lest anyone be under the illusion that these panels are carefully peer-selected and reviewed, that there's some committee somewhere finding the cream of modern geekhood -- well maybe that was how the others were chosen but for me, I was hanging out in the speaker room when Sarah, who I'd only just met, asked me if I'd do it and I said yes.
I had a lovely time at the panel and we all spoke about our experiences, advice to newbies, how nice it is not being "the only one in the room" from time to time, and so on. I was sitting with Catherine and Cyra, two of my fellow panelists, and Charles Torre of Channel 9 was with us, and we talked over dinner and wine the way in my experience geeky women always do -- a fast paced mix of very technical shoptalk and personal getting-to-know-each other material. (I learned a lot from Cyra and wish we had had more time together.) When the event ended, the four of us walked together across the street to the speaker hotel, but it was such a short walk and we weren't finished talking. Someone expressed an interest in dessert, and we decided to see what the lobby bar had to offer. We kept on talking, and at one point Catherine and I were trying to convince Charles that "the compiler is your friend" -- that strong typing and early binding have big advantages. Charles kept saying "I can't believe I'm not filming this" until eventually he picked up the camera and started to film. He asked us questions he knew we cared strongly about and off we went.
The resulting video is now on Channel 9. It seems to kind of start in the middle because, well, we started in the middle. I suspect it's the only video on Channel 9 featuring gestures with a glass of Scotch. It's one of the very few that doesn't feature exclusively Microsoft employees, so I am honoured to see it there. Those of you who have heard my line "I stay up late over too much red wine arguing about deterministic destruction" can now see that in action. We don't introduce ourselves till the very end, so if you need to know who's who, download the whole thing, skip to the end, then go back to the beginning and watch us.
Wednesday, 06 December 2006
Man, I've been making software for a long time. I first came across Fred Brooks' essay No Silver Bullet: Essence and Accidents of Software Engineering when the mail (you remember, the physical mail) brought me the magazine (you remember physical magazines) and it was the cover story. Apparently that was the April 1987 issue which is bringing us perilously close to the twenty year mark. (And if I needed to, I could get my hands on that copy within minutes... in fact I'm sure I've held it within the last year or two.) And now people are talking about it again. Larry O'Brien has a long post with links to some other posts of his own and by Wesner Moise. He also captures what I consider to be the essential quote from the essay:
I believe the hard part of building software to be the specification, design, and testing of this conceptual construct, not the labor of representing it and testing the fidelity of the representation. We still make syntax errors, to be sure; but they are fuzz compared with the conceptual errors in most systems.
The thesis is that software development gets easier or faster or more accurate only by degrees: you cannot adopt structured programming or object oriented programming or aspect oriented programming or functional programming or agile techniques or anything and expect to be ten times faster or a hundred times faster, no matter what people tell you:
There is no single development, in either technology or in management technique, that by itself promises even one order-of-magnitude improvement in productivity, in reliability, in simplicity.
It was true then and it is true now. And it will still be true when my kids are as old and grey as I am becoming. Worth reading and rereading, and not waiting twenty years between rereads. Oh and by the way, this is the same Fred Brooks who invented the heavens-I-wish-it-wasn't-true rule: Adding more people to a late project makes it later. That's from 1975 and you can't escape it either.
OK, there is one way you can achieve an order of magnitude improvement in productivity: hire the right people. The good ones are ten times as fast as the OK ones, and infinitely faster than the none-of-their-code-ever-ships ones. But that's not a technology or a management technique, so it doesn't count for our purposes.
Tuesday, 05 December 2006
Here's another neat way to search in Visual Studio. Press Ctrl-i to get into incremental search mode, and start typing:
Typing e finds the first e in the file. Keep going and find the next instance of your letter pair:
It keeps going as long as you want:
By the way the binoculars/arrows cursor reminds you what you're doing. Until you press Escape, you can also do Ctrl-i again to just go to the next one, Shift-Ctrl-i to go backwards, and Backspace to take a letter off your search string.
Fun, eh? I may like search in Visual Studio too much ... I routinely use the Find in Files to search folders of stuff that isn't anywhere close to code. Of course I don't have to do that on my Vista machines, where search is nice and fast.
Monday, 04 December 2006
My recent post of a joke about a priest and a politician highlights a privacy issue: sometimes any sufficiently specific information can become identifying information. If the priest had referred to "one of the first confessions" instead of "my very first confession" nobody would have learned anything when the late-arriving politician told the crowd he was the very first to give confession to the then-new priest. Similarly when a CIA operative was identified in the USA, at one point the person who identified her took refuge in pointing out he hadn't named her, hadn't said "X Y is an operative", but instead had named her husband, "A B is married to an operative." Of course that was equivalent to naming her.
Similarly, when you're worrying about privacy in an application, it's not as simple as naming some fields you shouldn't include in the system. That's a good first step, for sure: why does this application have a field for Social Insurance Number, what do we use it for? Why do we need to keep it after that? But it's not the whole story. For example, we may need everyone's home phone numbers, but do we need them on the main screen or would it be better to make people click to see the more private information. Can we use role based security to show private information only to managers? This takes some thought.
Microsoft is offering a 49 page Privacy Guidelines whitepaper you may find helpful. The introduction says:
The purpose of this document is to propose a baseline for establishing this higher bar. It offers guidance for creating notice and consent experiences, providing sufficient data security, maintaining data integrity, offering customer access, and supplying controls when developing software products and Web sites. These guidelines are based on the core concepts of the Organisation for Economic Co-operation and Development (OECD) Fair Information Practices and privacy laws such as the EU Data Protection Directive, the U.S. Children’s Online Privacy Protection Act of 1998 (COPPA), and the U.S. Computer Fraud and Abuse Act (as amended 1994 and 1996). In the interest of developing a common set of industry best practices for privacy, we invite the community and other interested parties to participate in an open dialogue.
It discusses categories of information, retention, consent, notice, and a few things that are web-specific like cookies. A good place to start your thought process.
Sunday, 03 December 2006
Technology Review has an interview with the father of C++. Some notable quotes:
- There has to be languages for those experts to use--and C++ is one of those languages.
- I want elegant and efficient code. Sometimes I get it. These dichotomies (between efficiency versus correctness, efficiency versus programmer time, efficiency versus high-level, et cetera.) are bogus.
- There are just two kinds of languages: the ones everybody complains about and the ones nobody uses.
- The main reason for C++'s success is simply that it meets its limited design aims: it can express a huge range of ideas directly and efficiently. C++ was not designed to do just one thing really well or to prevent people doing things considered "bad." Instead, I concentrated on generality and performance.
Read the whole thing!
Saturday, 02 December 2006
UAC got you all confused? Do you think the best thing to do is turn it off? Maybe this article on TechNet will help a little. It's quite long, and not entirely developer focused, but it's a good place to start understanding what UAC is for and why it would be best not to turn it off.
© Copyright 2018 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Thursday, 18 October 2018 03:46:53 (Eastern Daylight Time, UTC-04:00)
On this page....
Pluralsight Free Trial
Click Start a FREE 10-Day trial