Thursday, September 30, 2010

Code Shot – Doctypes


First Quick Code Shot…less talk; more code.

Xhtml 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Xhtml 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Html 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Html 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Html 5
<!DOCTYPE html >
There are others; however, these are the primary ones that I either use or have seen a decent amount in the wild.

-J

Wednesday, September 29, 2010

A New Format Coming

I'll admit, I've been pretty lax on my blogging as of late.  This has been due to a number of reasons / excuses that I won't bore you with.  Regardless, it's a part of my life that I'm working on getting back into the habit with.

One issue that I always had with blogging was the time aspect.  A commentary post would take me 2-4hrs to write and post while a code one could take me 8-24hrs depending on the size and depth of the material.

Starting this week, a new format of code-related posts will begin to trickle onto this blog.  I'm dubbing these Code Shots since they are going to be terse and more focused on the code them the blocks of text surrounding them.  This format makes a lot more sense when you 1) the samples are simple and short and 2) most of the people who read this blog can read code.

Expect some Code Shots on topics ranging from Html5 to JavaScript and even inter-language interop.

Stay Tuned!

- J

Tuesday, September 7, 2010

The Paradox of Choice for a Programmer

apple-1984-advert In everyone’s life, we strive to find our own self-identity.  Some of us establish ourselves rather naturally while other’s take a while to truly understand and mold their own self truth.  We see it every day with every time we experience new things and try out different solutions to a problem; be it in algebra, Rubik’s Cube, or even a more socially-related problem.  This search for self-identity is apparent to everyone since no one wants to be a nameless drone who mindlessly obeys big brother; we want to stand out from the rest.  We want to be unique, just like everyone else.  This sense of identity and individualism surpasses the realm of how an individual acts or behaves, it also crosses into a realm of how a person shapes their career. While this is an extremely important factor in some fields (i.e. Journalism, Politics, Sports, etc), it can also cause issues in other fields.


Individualism in a career leads to people trying to be the best at what they do. Journalists and photographers strive for the recognition of fame and prizes; politicians strive to be elected. People strive to seek value in what they do and eventually hope to build a reputation (and furthermore a legacy) around their works and their individual brands; however, this could also turn into a self destructive motive in some fields.  One such field is software development.


No field isn’t without its celebrities.  In the greater Information Technology field; it’s hard to argue that Bill Gates, Steve Jobs, and Linus Torvalds are amongst some of the names that come to mind as “celebrities” in the culture.  In every development circle, be it .Net, Java, Lisp, or Ruby, there are also those types of people who tend to stand out and people recognize the names. At a micro level inside of your company, is there a celebrity or “go-to” person whenever there’s a crisis that tends to wave their hands and make the fires go away?  Here’s the catch though, what happens when your company has more than 1 of these people?


Software developers are a lot like carpenters, in my opinion, when it comes to individualism. Each professional has a set of restraints but no 2 may do the same thing the same way. Sure there are frameworks and regulations that have to be adhered to but in the end, how the product was ultimately constructed could be vastly different.  This is where the issue of individualism in our profession can be seen the greatest.


I once worked for a company who wrote a number of different software solutions for a wide variety of clients.  These projects ranged from Business-To-Business process to e-Commerce sites to internally used CRMs.  For years the request always came in and for years the same types of application were developed from scratch.  Admittingly, I was part of the problem; I focused on the differences and argued that a standard platform couldn’t be developed. Experience has taught me that I was wrong in those days.  The issue with reinventing these applications each time was each one was different to varying degrees depending on who developed it.  As developers on the team shifted from project to project or as new developers came on board, the projects turned into a nightmare of a learning curve.  In addition to the learning curve was the issue that it caused deadlines to be extended. The only advantage was that each developer learned from their past experiences (usually).


 unique


Obviously, the need to automate the foundation was seen but at this point, the paradox of choice sat in.  Which of the various frameworks that other people had made do you chose to be the basis of all applications going forward? Since we’re talking about business-related decisions, it could turn political at times and personal matters of pride at others. It’s not an easy question to answer.  The same can be said about a new, rank amateur developer who just started or is thinking about starting.  Not only is it a choice of platform (Web, desktop, etc.) or language; but also a matter of what frameworks to use with such.  If we target .Net and pick C# and the web platform; MS now has ~4 frameworks to focus on (Silverlight, WebForms, MVC, WebPages)…looking at just MVC, there’s a large list of subprojects by other developers within the community who enhanced it in their own image; some more widely known than others.  A person may ask which is better on a forum and then the whole pissing match of which framework tastes great or is less filling.  A person become paralyzed by the amount of analysis he or she feels just to make a simple decision. This is the paradox of choice; too many choices leads to analysis paralysis. Below is a video that accentuates the paradox of choice further if you are interested.



So what is a person and/or company to do when faced with a number of individuals who believe theirs is the best way?  Ultimately, just decide.  To an extent, this is risky; however, nothing says that you can’t change later.  Egos will subside since the goal is to work more efficiently as a company, as a collective.   Put the vocal critics in the forefront of the decision since they, theoretically speaking, will be the most critical of the decision and have their eyes open the most to issues that may arise.  For those issues, those same people may turn into the ones who enhance the decision more into something even better for the whole as well. Furthermore, nothing says that you can’t decide to focus on the parts and not on any whole framework. Sometimes, it’s better to find small tools and utilities instead of something completely encompassing.  The key though is to just decide and don’t be afraid to change if you need to later.  People can still make a name for themselves and still seek individuality within and outside of a company and community.  The secret is to strive for the collective of a given company to form their own group identity for when that happens, individual styles will merge and anything is possible.

Saturday, August 21, 2010

Social Media - The Way of Becoming Antisocial

I'll get back to the code-related posts shortly; however, right now I just want to type something up that has been on my mind recently. I've been looking at the affects Social Media streams have been used by different people and entities while also watching the trends of other industries. Quite frankly, I'm scared what the future holds. In my opinion, social media gives people a false sense of connectivity to people and popularity. Seriously, do YOU truly care how many followers you have on Twitter or how many friends you have on MySpace or Facebook? How often do you meet those same people in person and under what occasions brings such a true in-person interaction?

I use Twitter for a lot of fast questions and to get information on the career aspect of my life. I use it, and thus the people I follow, more for their collective humor and knowledge than to really have conversations about their kids or their ailing relatives. Facebook I use for more personal reasons to keep in touch with friends I've made over the years that have moved away...people I miss and always want to share a pint with whenever I'm in their city. Sure there's a few local people I follow in both streams but the ratio is more in favor of distant friends.

Before the land of social media grew greater than IRC, IM, and Email, I loved getting a bunch of people from work, school, and from wherever and have a great time with a lan-party or a bar-b-que. Back then it was Warcraft II, Quake II/III, UT, and Starcraft. The days were great. Now look at the current game scene...the amount of co-op games are few and even Starcraft II doesn't (currently) offer LAN support. Playing over the internet is great but there's something to be said about sharing beers and obscenities with the person on the other side of the table who just killed you in the game.

How well do the people you connect with know you? How well do you allow them to know you? The people you work with will always fall under those you'd go out for a beer after work with and those you wouldn't. These are people you work with and interact with every work day...assuming you don't work remotely. Now a days there's a lot of people who say you should always manage your personal brand online and not ask stupid, "n00b" questions online or reveal some embarrassing facts and what not. These are things you can't really hide in person because such things affect our personality. If you only talk to people online and pretend your a genius, what happens when they find out your a fraud?

Social media has a place but a person still needs the in-person interactions. The trust you get from such is better than anything else you can get from just the 1's and 0's that come over the wire. A couple years ago I was told by a complete stranger (to me) that my grandfather was one of the greatest people he ever knew; the most honest and genuinely good person that this person had ever known supposedly. I don't doubt this stranger's opinion of my grandfather; however, it still makes me hope that I can live up to social precedence that my grandfather placed on this one person that effected him so much that he had to relay such information to a grandson he just met. Do you think ANY of your friends on Facebook or Twitter or MySpace will ever relay that information if they met one of your relatives? I truly don't know how it's even possible.

Wednesday, June 23, 2010

And Now For Something Completely Different

It's been a crazy past couple of months. Between all but reaching the point of burning out and having some family things I had to focus on, I was stretched pretty thin and had to make some cuts in my routine. From such, I have some ended up with some interesting observations and frustrations that has me changing my focus for this blog and my own pet project stuff. Some of these changes will lead to a lot of fun projects while others may piss off a few people. Hopefully, these changes will help inspire me to keep working on some new projects and to keep fueling the blog with some new content.

So What's New?

First thing's first...I'm turning into a Mac guy. After over 2 decades of using PCs, I ended up transitioning to a Mac over this past month. I have used Apple IIs and early Macs back in the day but those don't compare to the Macs of today obviously. After using my new MacBook Pro for a while, I may be completely changing everything to use my Mac. This means all of my personal .net development will more than likely be exclusively Mono-based. This leads to some interesting opportunities about not using Visual Studio or even Windows and has been a fairly painless transition thus far.

More things that the Mac opens up is that it provides a great platform for branching out to other platforms; namely Python, Ruby, Java, and mobile development. Yes I could do all of the same development on a Windows box; however, there are some tools and issues I've had in the past. In addition, if I was on a Windows box, I'd be tempted to use IronPython or IronRuby more. I like those languages from the little bit that I've played with them; however, I'm a firm believer that fundamentals are sometimes better than abstractions. So I'm going to be focusing on using the core languages first and then integrate the Iron* languages into my dev work later.

Why New Languages?

I used to be a Java developer years ago. Around the time .Net came out is when I transitioned into the MS world more whole heartedly. I'm working on getting back to my roots while expanding my knowledge into other realms. Over the past handful of years, I've seen the MS-related communities change in a way that, in my opinion, isn't good. A lot of this has been described by other people but from my own personal experience, I feel like the MS-related communities are like the subdued humans in Apple's famous 1984 commercial. It feels like as a community, the status quo has turned into going someplace and being told about a product that was released by MS. I'm guilty of falling into a trap as both a presenter and an observer. I would go to use groups and conferences and sit and listen while someone talked about the latest technology provided by MS. As a presenter, I was the one who put on the dog and pony show for the Managed Extensibility Framework. This blog is a testament to my own hypocrisy.

The issue that I have with this model is that it seems that over the past two years, almost everything has turned into one large non-commissioned marketing machine for the Microsoft way of doing things. I used to be all about Silverlight but now I can't look at it without feeling that it's a web-hosted version of VB6. I would love to say that I was excited to see ASP.Net MVC when it was released; however, around that same time, I was beginning to experiment with Rails and Django. Even to this day, the latest version of ASP.Net MVC doesn't really hold a candle to those frameworks. Yes there are some major differences in the foundations of those platforms; however, even from a feature perspective, the MS stack is lacking. In short, I feel that Rails and Django are significantly better platforms for developing web-based solutions than the MS provided stack.

Admittingly, I haven't looked too far outside of the MS stack myself. I looked at using nDjango and it was a huge change for a common VB or C# dev. I haven't looked at FubuMVC, Spring.Net nor MonoRail so these solutions may fill in the holes during my feature comparison. Even if these other open-source .net frameworks allow for better, faster, cheaper web development; there are still a lot of things that just doesn't exist in the MS space. The largest one being a package management system but it's not the only one.

Solution frameworks "measuring" aside, the community is beginning to concern me more and more every month. The perceptions are skewed. Mine was and to an extent, still is. I used to think that anyone who presents or has a blog is a super star. I have been called such; however, I assure you, I'm not. I started this blog and began to do speaking because I love to talk about technologies but also to provide an outlet to learn better. When I was doing Java development close to a decade ago, the community seemed more about helping each other and swapping war stories on how a developer fixed a given situation. I've never had that feeling at any .net function I've been to outside of an open space slot at a conference and even those are a crap shoot sometimes. The dialog between community members feels very limited. Twitter has been great for bouncing ideas and getting help to questions but applying such to a bunch of developers in a room at a conference seems to be difficult. Participation for such open discussions, round tables, and dojos seems to paralyze people. This is concerning.

So What Am I Going to Do About it?

I was told a long time ago to not bitch about something unless you offer a solution or at least some way to possibly change/improve what you're bitching about. To that end, I'm dramatically reducing my .Net coding outside of my day job. I want to learn more about other communities and languages and techniques. I learned a ton when I was playing around with Rails and Django years ago and, to a more MS extent, Subsonic. I want to continue learning such so that I can help apply those ideas back into my day job, my presentations to user groups and conferences, and of course this blog. If anything, more hybrid projects will come from such. I fully support mixing languages in solutions in order to take advantage of each language's strength. I have started working on a project that is utilizing HTML5, C#, F#, an Object Database, and IronRuby (for testing). This isn't something you'd see in today's .net ecosystem and it's not really advocated much by those who are doing MS's marketing. I'd love to see it in the wild but it's a far stretch for a number of reasons. Regardless, I'm going to be working on seeing about applying different concepts across the languages and see how things go.

So stay tuned. There's a lot of new stuff that's going to be coming down the pipe shortly and it'll truly be fairly random.

Saturday, May 15, 2010

My Thoughts on Pex

Earlier this week at work I got an email asking me to install Pex, Microsoft Research's White box Unit Testing framework for .Net.  While my company falling into the "early adopter" category (we're already on .Net 4 and VS2010), this one surprised me since it's a Research project.  I briefly looked into Pex last fall and didn't get too into it since I was content working with NUnit and my current unit testing tools.  Now that it appears that I may be using it to some extent at work, I decided to take a more meaningful look at it.

pexweb

Like I said previously, Pex is a MS Research project for doing White Box Unit Testing in .Net.  White Box unit testing means that the tests are focused to cover the current code.  This is one of the shining aspects of Pex; it will scan the code to be tested and generate unit tests that cover all logical paths within it.  This is a great way to bring your code coverage up if you aren't getting the coverage rate with your traditional habits.  After Pex scans and tests the code, you can drill into the tests themselves as well as the results.  Pex allows you to update your own code with conditions specific for code under test too.(e.g. Pex can add null argument validation code if you so desire)  When everything is all set with the tests that have ran, you can save them out into a separate or existing project so that they can be ran again later. In addition to all of these things, Pex comes wired up and ready to use an assortment of Unit Testing frameworks beyond MSTest so that it can play nicely with your existing tests and test runners also.

While those elements are awesome and helpful, there are a few things that turn me off of the framework.  Pex will dive into all dependencies found with in the code under test.  Where you traditionally may mock or stub out a dependency, if there's a hard dependency found, Pex will dive into it.  Now, this can be averted using some form of IoC container or Isolation Framework (more on this below); however, if you don't use one of these, that code will be tested as well.  In addition, Pex only tests Publicly exposed code.  If your code is marked as anything other than public, Pex will inform you that it can't test it.  This doesn't bode well for software businesses who have a lot of internal classes.  During my tests, I even tried to use the InternalsVisibleTo assembly attribute and it still wouldn't work with it.  Lastly, I was a bit disappointed in Pex only scans the currently active file inside of the IDE.  While there's a command line way of running Pex, supposedly, from within Visual Studio itself, Pex can only work with 1 file at a time.

Finally, Pex has this nice little buddy called Moles.  Moles is an isolation framework for handling dependencies.  You can use either without Pex; however, they are closely tied together from a project and documentation standpoint (if you find info on Moles, you'll almost always find info on Pex and visa versa).  Moles focuses on generating Stubs in the same way as frameworks like Rhino Mocks and NMock2; however, it also has what it calls Mole objects which focus on Sealed, Static, and or Privately scoped classes.  I did not dive too deep into Moles; however, it would appear that it does not mock these types but rather intercept and detour the method calls into the implementations you wire up. From my understanding this is similar to how TypeMock handles the same task.

Overall, I think Pex is a good product for people trying to get their code coverage up and are in a Test-Last mentality.  It works great under that situation and makes for a great candidate for automating unit test generation of DTO/Domain Model classes that tend to be public due to how they get passed around and usually consist of just getters and setters.  It's not a tool I see myself using personally, though.  I'm human and can see a very difficult argument in justifying a Test-First approach beyond design when Pex can/will write the tests for you.  Applying that logic to a business environment and justifying a few minutes to write some tests to a manager vs a few seconds to run Pex and generate more tests is a hard sell.

Iowa Code Camp - Spring '10 Review

icc_logo

Back on the first of May, many from the .Net community in the Midwest flocked to Iowa City, IA in order to attend the Iowa Code Camp.  For those that aren't aware, Code Camps are community driven events where speakers volunteer to give presentation on a variety of topics for people to come and learn.  The Iowa Code Camp happens twice a year and every time it's been a great event.

This Spring's Code Camp saw me presenting my talk on the Managed Extensibility Framework (MEF).  The talk went fairly well in my opinion though we are our own worst critics sometimes.  The feedback I got on the talk was very constructive and gave me a lot of things I need to work on beyond what I was able to find from personal reflection.  I also ended up recording my talk using my Flip MinoHD camera which works very well other then the fact that it's hard to tell how the HD video truly looks on a tiny screen.  If you present, I highly recommend that you record yourself either in practice and/or presentation in order to obtain additional feedback on yourself; since you know the subject matter, you'll find more things about your presentation style and quirks that many evaluation forms miss.

Beyond my presentation, there were 4 other time slots/talks available for me to attend.  This specific code camp I wanted to focus on solidifying my knowledge of topics that I have pretty much taught myself.  While I was very confident in my abilities with the code-related topics, I wanted to see another person's perspectives of such so that I can gauge my own understanding and learn a few new tips as well.  Below is a rundown of the sessions I attended:

 

IoC with StructureMap - By Brad Tutterow

Inversion of Control and Dependency Injection have been topics that some people get and some people still don't fully see the value of it.  I got it pretty quickly because of my TDD experience; however, am always interested to learn new things about IoC containers  and the patterns in general.  Going into this talk I figured there'd be some discussion on the principles and patterns; however, there'd be a lot of discussion on how to use StructureMap.  What the presentation turned out to be was a jewel.  The polished presentation focused probably 75% on IoC and DI with the last 25% being about StructureMap.  Brad did an excellent job in not only explaining the "What" of the topics but the "Why" as well.  Looking throughout the audience, I could see some people finally understand it and it's importance.  In addition, Brad provided a great, evolving example that went from tightly coupled to decoupled to implementing StructureMap for fully handling all dependencies.  The time with StructureMap may have been less than I expected, but the value of the presentation as a whole completely outweighed my curiosity on the "How". 

 

TDD Dojo - By John Teague

I've been unit testing my own code on side projects for a while now.  I don't always push them in my blog post examples (I should though; I know); however, seeing a true TDD with pair programming session was something I wanted to observe and partake in.  In my opinion, a person's adoption rate of TDD and specifically Test-First is directly related to how close they are to finding that spot in Red-Green-Refactor where they write enough tests and code to feel meaningful.  I've seen a lot of people get turned off with the RGR pattern and TDD's principle of doing the bare minimum because it seems too simple and impractical; however, if you can find a level between writing all of the code and writing the bare minimum, usually they begin to adopt it more.

This issue is one of the things I felt from John's session.  John's session was broken up into 2 sessions and I only stayed for the first half.  In the first half, there was a wide assortment of experience levels among attendees.  Some people have been doing TDD for a while; however, there were a number that either rarely unit test or have never unit tested at all.  This range made some people question to simplicity of TDD's cycles and the perception of the impracticality of it all.  Despite what the session abstract said, I believe people were expecting slides on how to do TDD instead of a more hands on approach...the different format, which included pairing in front of everyone, seemed to make some uncomfortable.

With that said though, John did a great job in handling all of the questions and comments and an even better job in helping people pair up and begin to get familiar with TDD.  It was really good to see a talk session in a different format and a practical flow.  It was really good to see how attendees who finished their pairing time to come back with a "I get it" look on their face. 

 

Open Session

There were no open sessions on the schedule for Iowa Code Camp this time around.  I had every intent to continue with John's Dojo for the second half; however, a few of my friends were in the session had never written a unit test and were a bit overwhelmed.  When I ended up doing instead is taking one aside and worked with him on a one on one basis to help him understand unit testing, in general, a bit better.  One thing I wanted to make sure though was to use the same frameworks that John used in the first half of his Dojo since he covered the basics of seeing up a test class and test methods. The developer I worked with absorbed these aspects of John's session; however, was having a hard time seeing how to apply it.  For example: show a person who's never unit tested a test that validates a method returns true is great; however, they tend to get lost in the practicality of the test when the method body just reads "return true;".  I worked with him on an example of splitting a paragraph into various lines after a certain length, ensuring words were not broken as well.  My example was well; however, I didn't do so well on demonstrating stuff.  Towards the end though, he had written his first couple unit tests though and saw it working.  Now for me to go through more katas myself - practice makes perfect right?

 

Being a Technology Entrepreneur - By Scott Davis

This session was packed. I've looked into doing some side projects and freelance work in the past and this talk helped provide some insight on how I should go about doing such correctly from the start in the event that I wanted to go from simple freelancing to turning it into a true business.  Scott's advice was fantastic and the information he provided on the types of things to be mindful of was invaluable.  He kept everything relevant from things you should do when dealing with an attorney or accountant to what and how long it takes to setup a business with your local state.  His information on what types of businesses you should be looking at as well as how companies like Microsoft can help out as well.  Scott's talking again at the Kansas City Developers Conference in June and I may be attending the talk again since I know there'll be more things I didn't pick up on the first time around.

 

Learning Distributed Source Control with Mercurial - By Chris Sutton

Chris was kind enough to allow me record his talk despite the fact that I went to a different session (Thanks again, Chris!).  I have very little knowledge of Mercural (Hg) or Git so I was hoping to attend a talk on one of these while there; however, there were so many good sessions I had to resort to my recording.  Chris did a great job on presenting Hg.  He provided a great explanation of distributed version control systems and how they different from more traditional options like Subversion or Team Foundation Server.  His examples showed how to use Hg in a variety of tasks.  There were a lot of good questions during the discussion in terms of branching, merging, and comparisons which Chris fielded very well.  This talk wanted me to move all of my code to a dvcs instead of the systems I've been using up to this point.

 

Reflections

After looking over my notes and the conversations I had surrounding the event; I wish it was longer.  Being able to bounce ideas from other developers and also focus on ways to make the event better was great.  Everyone involved in putting on the event was fantastic and for that Thank You!  I'm looking forward to (at least) attending the next Iowa Code Camp in November and see what may come from that.

Outside of the great event, there were a lot of things that I noticed.  The talks with the most interest were associated with either mobile development or Scott's Entrepreneurship talk.  Mobile is a hugely hot topic in the industry and the entrepreneurship talk's attendance matches what I've been seeing on Twitter and other conversations.  There seems to be a desire for information on how to be better outside of the code.  This is not to say that there should be talks on how to be a manager; however, how to be better at business, interactions with others, and skills that are important but not about really writing code.  I've been seeing this for a while; however I'm seeing the trend increase for things like Scott's talk as well as Brian H. Prince's Soft Skills talk.

In addition, I noticed the experience gap.  Now, I'm not expecting everyone to be super star developers; however, I see a need for something additional to be made available to help those understand concepts they may not fully understand before or even after a topic.  There isn't a magic bullet that provides the solution to this, but it's something that I am brainstorming on.  Should there be a 100% open spaces track dedicated to "mentoring" and helping people out with different topics or projects than just a discussion of random things like some open spaces turn into?  Should there be prerequisites suggested for every session?  Am I actually just imagining this gap?

Lastly, this code camp brought a lot of insight into myself.  After seeing the presentations and also this TED talk on how leaders inspire action, I'm going to be changing my MEF presentation around a lot. Brad did a great job in his presentation in building an understanding of why things are important and why he's passionate about such.  This is something that I felt was lacking from my presentation.  In addition, I'm hoping to get more involved in the near future.  Do I know specifically what that means, no but that's the beauty of community, people can fill where the need is.  In addition, I may be moving my presentation focus away from tools and into a more community focused array of topics; like Interviewing Skills, getting involved in Open Source Software, and ways to become a better developer and getting involved in the community.  Needless to say, there's no shortage of things I can improve upon with in myself and my abilities.  I can't wait to see how I'll grow and be ready for the next Iowa Code Camp.

 

Contact Information: