Archive for October, 2010
The other day I was pairing with my buddy and co-worker Alan Stevens. We were reviewing some code, and at one point he said: “Claudio, those comments are ugly!”. At first I thought he meant how comments were worded, but then I realized he meant the way the comments were formatted:
You can see in the snapshot above that something really stands out, right?
Comments (which include code that’s commented out, but *not* XML Comments) are formatted in my environment in a very nasty way, and that’s on purpose. The thing is so ugly, it forces me to read it and find out what it’s all about:
- It may be a TODO, so I want to make sure it won’t be forgotten (very often, a TODO is dropped in code to indicate some Technical Debt);
- It may be code that’s commented out that should have been removed in the first place, instead of be sitting there as waste, polluting our code base with useless, distracting things. “But what if we ever need that code back?”, one might ask. Well, hello-oh, it’s 2010; people better be using some sort of Source Control System!!
- It may be the means of a developer to explain some poorly written code; most times a simple “rename variable” or “extract method” refactoring can easily remove the need of the crappy comment;
- In very rare situations, the comment is actually useful in explaining the intent of the code, so it’s a good thing that it stands out.
It comes a time when code may be tainted with so much useless comment that the mind just starts to ignore the warnings. What do I do? Just change the coloring to some other new ugly combination.
How about you: do you have similar approach regarding how you see comments in the code? Do you configure your environment so to have the editor visually indicate anything you deem important?
Three Locations – Houston, Dallas, and Phoenix
- Houston: Tuesday, November 9, 2010 1:30 – 4:30 PM
Microsoft Houston Office – 2000 W Sam Houston Pkway S, Houston, TX 77042
- Dallas: Monday, November 15, 2010 1:30 – 4:30 PM
Microsoft Dallas Office – 7000 SR-161 (George Bush Turnpike), Irving, TX 75039
- Phoenix: Thursday, November 11, 2010 1:30 – 4:30 PM
Microsoft Phoenix Office – 2929 N. Central Ave, Suite 1400, Phoenix, AZ 85012
Brought to you by Microsoft, CODE Magazine, CODE Training & EPS Software, this free afternoon event presents an unbiased look at the current and future development with .NET. Join me for an afternoon of free and independent information about current Microsoft development technologies! What is the state of .NET today? Which of the many .NET technologies have gained traction? Which ones can you ignore for now? What other Microsoft technologies should you include in your development efforts? This event is completely free of charge and is designed for developers as well as IT decision makers. Specific prior knowledge is not required. Attendees of this event will come away with a clear understanding of which technologies to use for various technical challenges.
Topics will include:
- Latest News from PDC!
- Visual Studio 2010
- Silverlight 4.0
- Visual Studio LightSwitch
- Expression Studio
- ASP.NET MVC 3.0
- Windows Phone 7
- and more!
Note: The final list of topics is always subject to change as we are always aiming to have the most up-to-date content possible!
Signup is free, but you have to let us know you are coming. Here are the appropriate links:
- Houston Signup Link – Tuesday, November 9, 2010 1:30 – 4:30
- Dallas Signup Link – Monday, November 15, 2010 1:30 – 4:30
- Phoenix Signup Link – Thursday, November 11, 2010 1:30 – 4:30
Questions? Please e-mail firstname.lastname@example.org or call 832-717-4445 begin_of_the_skype_highlighting 832-717-4445 end_of_the_skype_highlighting x32.
This event is co-hosted by EPS Software Corp. and Microsoft Corporation. EPS is responsible for all content presented at this event.
I was just getting started with helping out the Visual FoxPro community, by translating articles from English to Portuguese, and answering questions at the online forums. When VFP 7 was going to be released, Paulo Cesar, a member of the community, asked the local Microsoft office whether they’d have any official launch event in Brazil. MS had absolutely nobody down there who knew anything about VFP, so Paulo Cesar suggested I should be the one doing the presentation. I said, “ok, I guess if nobody will can do it, I can try it.”
After getting a copy of VFP 7 Release Candidate from MS, I started to prepare for the presentation. It was going to be a 1-day event, so I needed material to talk for about 8 hours. Since so much preparation went into it, I’ve ended up recording some videos out of it to sell it later, with the help of Vidigal (an outstanding person who has helped that community a LOT).
Given the good number of signups, MS asked me to do the presentation twice, because they had maxed out the capacity of their local office, about 120 people showed up at each date. That was a great number, considering VFP wasn’t as popular as VB or Delphi. People came from really far away to attend to those events.
I’ve received such good feedback from people (including from those that had traveled for several hours to be there) that I’ve decided I should do more presentations. And that’s how it has been for the last 10 years.
Now I feel like it’s time to take a break from that.
Don’t get me wrong: I *really* enjoy giving presentations. While some people do it for the fame, I guess, I do it because to me it’s very rewarding to hear somebody say “hey man, that thing I learned at one of your presentations has helped me a lot”. Like an old buddy of mine once told me, “if I help 500 people, and on my time of need, one of those people help me out, I’ll be happy”. But I just feel like I need to take some rest from traveling, preparing for talks, and most importantly, and most importantly, figure out what things I’d like to learn next.
My plans for 2011 is to continue on with the Virtual Brown Bag every week, and I may end up doing a few presentations at local user groups in Houston, or another areas that won’t require a long trip, but other than that, I want to take the time to focus on learning. I want to learn other languages, frameworks, and platforms that I haven’t been too involved with.
Wish me luck.
I’ve had a great time speaking at the Tyson Developer Conference last Friday, and at the Northwest Arkansas CodeCamp on Saturday. I’d like to thank everybody who came to my sessions, and also the organizers for inviting me to speak there.
As promised, I’m posting all my session material. Please, take the time to rate my sessions and provide me some feedback so I know what I have to do to improve next time. You’ll find the downloadable materials in the following links:
Tyson Developer Conference:
- Beyond the Core Concepts of OOP (SOLID)
- Be a Professional Developer and Write Clean Code
- Refactoring, Patterns, Language Features, Code Quality, and more!
- Tips & Trips to Boost Productivity
Northwest Arkansas CodeCamp
See you next time!
Last year I couldn’t make it to Tyson Developers Conference (I was speaking at TechEd Europe in Berlin that same week), but this time it worked out, so not only will I be speaking at the TDC, but I’ll also staying over an extra day to speak at the Nortwest Arkansas CodeCamp. I have made some good buddies in that area, so I’m looking forward to going there.
Here are the topics I’ll be presenting on at TDC:
- Beyond the Core Concepts of OOP (SOLID)
- Be a Professional Developer and Write Clean Code!
- Refactoring, Patterns, new language features, code quality, and more!
- Tips & Tricks to Boost Productivity
And here at the topics for the Northwest Arkansas CodeCamp:
See some of you there!
Another Thursday, another fun Virtual Brown Bag. JB shared some more Rails/Heroku love today, and how he’s implemented the registration/login feature of http://www.virtualbrownbag.com. The more I hear and see things about Rails/Heroku, the more I like it. I need to find me some time to start messing with those things.
We had a special request from Mark, one of our frequent VBBers: he wanted to see a little example of MVVM, and maybe have a little talk on MVC.
I showed a very simplistic sample of a WPF app, where we started with having most of the code in a code-behind for a window, and then moving the code out into a ViewModel. We’ve covered the core differences between MVC (Model-View-Controller), MVP (Model-View-Presenter), and MVVM (Model-View-ViewModel, or also known as Presentation Model). The idea bein g that they’re all “presentation patterns”, aimed to better structure the code that sits closer to the User Interface.
So why so many different patterns just for that? Well, each one has a slight different structure to cater for the scenario have at hand. In MVP, the Presenter takes care of providing behavior to the View. The View does nothing more than delegating things to the Presenter. This allows the Presenter to be reused independently of the View, and it’s also testable.
In MVVM, the ViewModel gives shape to the data coming from the Model, tailoring it to the View needs. For instance, the Model may have separate properties for Address, City, State, whereas the View calls for just a single property representing the Full Address; the ViewModel will handle just massaging of the data. ViewModels fit in nicely with WPF/Silverlight due to their data binding features.
In MVC, the Controller is usually the one responsible for executing behavior, and in web applications the Controller is usually the point of entry for the user to execute operations: when the user either enters a URL in the browser directly, or clicks something on the page that sends a request to the server, there’s a Controller intercepts the call and takes the appropriate action.
ViewModels are commonly used in MVC applications as well, but different than in WPF/Silverlight applications, they only provide the “data reshaping” aspect of it.
Even on a MVVM WPF/Silverlight application you may find “Controllers”, usually helping out with the way the application flows through menus and screens.
MVP is usually the best bet for WinForms and WebForms applications. So why not use MVVM in a WinForms application? Because MVVM leverages the WPF/Silverlight data binding capabilities, which in WinForms aren’t that great.
As with all design patterns, there isn’t one presentation pattern that’s the silver bullet to all applications. Depending on context, requirements, etc., a single application may mix and match these patterns: have a Login screen implemented using MVP, whereas an order placement screen may be implemented using MVVP, whereas a more complex composite screen may be using MVVM with a Controller added to handle the flow between the different parts of the screen.
This post isn’t supposed to be nothing more than a brain dump as to what we’ve discussed at the Virtual Brown Bag this week. Please make sure to take the time and go do some research and experimentation on your own.
I’ve enjoyed Scott Hanselman’s “two must have tools for readable web” post, and have been following that kind of workflow for sometime now. I’ve tried Instapaper, but decided to just stick with Evernote for that as well. I use the Readability bookmarklet to get rid of the noise, and send the whole page to Evernote. I then apply a “read later” tag to it, and usually read things later on on my iPad.
I’ve incorporated Posh-Hg in my setup. It gives nice tab completion in Powershell for the Mercurial commands, and it also customizes the command prompt to display some useful information (such as what branch I’m currently on, how many files added/changed/deleted, etc.)
Favorite Things, according to the VBBers
I asked attendees about their favorites things they’ve either learned or shared at the Virtual Brown Bag. This is the kind of things I got:
- Productivity Tools (we’ve covered a good number of tips and tricks overtime on tools such as CodeRush, ReSharper, Executor, etc., and we’re certainly going to continue doing so).
- Feeling I’m on the right track with development
- Knowing I’m not alone in my questions concerning development
- I appreciate the help of those of us less experienced in development (great, we’ll certainly continue covering things for all levels)
- Pomodoro Technique
- LINQ tips and tricks, like the .Any(x => x.Condition) instead of the .Count(x => x.Condition) > 0
- I love what you did replacing a switch using a Dictionary<DayOfWeek.Action>
Things that I’ve personally learned/enjoyed since we started:
- How people step up and help us keep the VBB’s going:
- Zach Young: who allowed us to use the Virtual Alt.Net LiveMeeting room to host the VBB, as well as processing the recordings, posting it to Viddler, and listing it at the VAN site.
- JB: who’s helped out being the host several times when I couldn’t make it (usually because I’m travelling). Not to mention the tons of things he’s shared, besides bringing www.VirtualBrownBag.com to life.
- Ed Evans: who’s taken the initiative to create a wiki page for the VBB
- Jared Lobberecht: who’s stepped up and automated the process of processing the videos, so they become available online just a few hours after the meeting has ended.
- Brian Shroer: who’s been updating the wiki live during meetings, with timestamps, notes, links, etc.
- At one of the VBB’s over a year ago, I was showing SlickRun, and then somebody showed Executor, which I’ve switched to and can’t live without.
- A few weeks ago, somebody asked me if I could do an intro to Mercurial/Branch by Feature. That was fun. Even though I’m a total beginner with Mercurial, I think I was able to do it, which proves the point that Mercurial is such an easy source control system to use.
- Sharing both Evernote and the Pomodoro Technique have been fun for me, and I’ve noticed people on Twitter talking about it, so that’s great.
The Live Virtual Brown Bag session at the Houston TechFest 2010 was well attended, and I hope we’ll be getting more and more attendees every week now. At the TechFest we’ve launched t he official site for the Virtual Brown Bag, containing information on what the VBB is all about, links to the Wiki and Recordings, and a place for people to post their suggestions on things we could talk about. Make sure to check it out!