{"id":5481,"date":"2010-03-08T07:24:44","date_gmt":"2010-03-08T07:24:44","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/bharry\/2010\/03\/08\/series-on-programming-practices\/"},"modified":"2018-08-14T00:20:32","modified_gmt":"2018-08-14T00:20:32","slug":"series-on-programming-practices","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/bharry\/series-on-programming-practices\/","title":{"rendered":"Series on Programming Practices"},"content":{"rendered":"<p>This is the first post in a series I&rsquo;ve decided to write on my Programming Practices.&nbsp; I&rsquo;m not trying to say everyone has to do it the way I do it but I figured it might be interesting to talk about how I do it and have some fun, if sometimes controversial, discussions about it.\nA little before Christmas, when I decided that I really wanted to understand the Beta 2 performance issues first hand, I picked up a programming project that I&rsquo;d been kicking around and started to get serious about it.&nbsp; My job doesn&rsquo;t really afford me the opportunity to spend a lot of time writing code any more but I&rsquo;ve gone out of my way to really set aside some time to do it.&nbsp; Over the past few months, I&rsquo;ve probably averaged 10-20 hours a week of dedicated coding time.\nAs I was coding I decided to watch myself closely and try to observe what practices I naturally follow with the goal of eventually sharing them more broadly.&nbsp; I&rsquo;ve generally always been very proud of the productivity, organization, performance and quality of my coding.&nbsp; Once you see it, you can decide for yourself whether you like it, dislike it or just think it&rsquo;s stupid \ud83d\ude42&nbsp; I&rsquo;m sure the practices don&rsquo;t apply to everyone or every application type.&nbsp; I have always done commercial software and much of it at a fairly low level &ldquo;systems&rdquo; level.&nbsp; I&rsquo;m not sure how much of what I&rsquo;m going to describe will apply to someone who is primarily a jscript\/html coder.&nbsp; You can judge for yourself.\nThe project I picked up is a new version of TFSServerManager.&nbsp; It&rsquo;s particularly interesting because it has many components.&nbsp; It has a client GUI, written in WinForms (I&rsquo;ve played with WPF but I can&rsquo;t say I&rsquo;m proficient at it enough to feel particularly competent &ndash; once I finish this project, I think I&rsquo;m going to try a full WPF\/Silverlight app).&nbsp; It also has a web service that runs on the TFS server and augments TFS with a few capabilities that aren&rsquo;t available &ldquo;out of the box&rdquo; &ndash; doing some SQL access.&nbsp; There&rsquo;s some ASPX pages for lightweight user interaction for a few things (more on that later).&nbsp; And lastly there&rsquo;s a command line installation utility.&nbsp; A fairly diverse technology set in all.\nI also took this project as an opportunity to explore asynchronous rich client programming a bit more.&nbsp; It pains me that the TFS client makes so many web service calls on the UI thread causing the IDE to &ldquo;pause&rdquo; if the server is ever slow to respond.&nbsp; It ended up this way because we didn&rsquo;t lay out a great pattern for all of the developers to follow up front and stuff just kind of unfolded the way it did because it&rsquo;s easier to put all the logic on the UI thread than it is to partition it.&nbsp; So as part of this project I set out to have every single server call occur on a background thread and create an architecture that would make it easy to do.&nbsp; My goal is to make it no harder to program this way than putting all the logic on the UI thread.&nbsp; That goal is a bit harder to achieve with WinForms because it does not lend itself to good presentation\/computation separation (e.g. MVC &ndash; Model View Controller or one of the variants).&nbsp; When I start my WFP project, I&rsquo;m going to adjust the pattern for MVC and I think it will get even better.&nbsp; Anyway, through the course of this series, I&rsquo;ll share with you the architecture I created.\nI won&rsquo;t be surprised if it takes me weeks, or even months, to get through the whole series.&nbsp; I&rsquo;ve got a lot of thoughts and I think it&rsquo;s going to be a pretty big investment for me to make them all intelligible \ud83d\ude42\nI hope you find it useful,<\/p>\n<p>Brian<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the first post in a series I&rsquo;ve decided to write on my Programming Practices.&nbsp; I&rsquo;m not trying to say everyone has to do it the way I do it but I figured it might be interesting to talk about how I do it and have some fun, if sometimes controversial, discussions about it. [&hellip;]<\/p>\n","protected":false},"author":244,"featured_media":14617,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[4],"class_list":["post-5481","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-visual-studio"],"acf":[],"blog_post_summary":"<p>This is the first post in a series I&rsquo;ve decided to write on my Programming Practices.&nbsp; I&rsquo;m not trying to say everyone has to do it the way I do it but I figured it might be interesting to talk about how I do it and have some fun, if sometimes controversial, discussions about it. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/posts\/5481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/users\/244"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/comments?post=5481"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/posts\/5481\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/media\/14617"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/media?parent=5481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/categories?post=5481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/bharry\/wp-json\/wp\/v2\/tags?post=5481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}