Blog Stats
  • Posts - 48
  • Articles - 0
  • Comments - 107
  • Trackbacks - 0

 

Monday, November 16, 2009

Send in questions for upcoming guests and get DotNetRadio SWAG

Gil Zilberfeld from TypeMock: As you may know by now (from my tweeting or by looking on the DotNetRadio schedule listed on the site) there is an upcoming interview with Gil Zilberfeld from TypeMock.  He will be on the show at 5am PST.  Please send in your TypeMock and unit testing questions for him.  The submitters of any questions that I use on the show will get some DotNetRadio swag!

Jeffrey Palermo from Headspring Systems: What you may not know is that I am scheduling an interview (possibly tomorrow) with Jeffrey Palermo from Headspring Systems (creator of MVC Contrib and author of ASP.NET MVC in Action).  We will be discussing MVC Contrib and application architecture using that project.  Send your questions for him soon as that interview may be taking place as early as tomorrow evening if things work out.

Feedback: In addition to sending in questions, please also send in your feedback.  As this is a new podcast I am testing out the show format, music, ad spaces, etc.  If you have any feedback, good or bad, please send it to me at podcast@dotnetradio.com.

Guest Ideas?  Also, I have a long list of guests that I am trying to get on to the show that I think would be fun to hear from.   But I am sure that there are many listeners out there that may have a different idea of who would be a good guest on the show.  If you have some ideas please feel free to send them my way to podcast@dotnetradio.com!

Saturday, November 14, 2009

DotNetRadio.com - Podcast #2 – interview with Atif Aziz creator of ELMAH

http://dotnetradio.com/archive/2009/11/13/podcast-2.aspx

Andrew sits down with Atif Aziz. Atif Aziz is a senior IT business analyst at Cargill International and an ex-Microsoftie. His primary focus is helping customers move to the .NET Framework. He speaks regularly at Microsoft conferences and can be reached through his web site. You can find out more about Atif Aziz by visiting his web site www.raboof.com.

  • Raboof.com = FooBar!!
  • Atif describes to us what ELMAH is and the history behind it. He then goes into detail as to how to get ELMAH installed and running. Atif then outlines the types of storage that are supported and how to implement a custom storage provider. Next we get into how ELMAH handles exceptions, how it works with the .NET runtime, and what the appropriate way to handle exceptions with ELMAH is. He then gets into the details of how to signal ELMAH about exceptions that occur as the filtering that ELMAH provides.
  • OrbitOne ASP.NET Exception Reporting (based on ELMAH) – a good example of centralized exception logging and extending ELMAH
  • ELMAH has earned Veracode Application Security rating and has earned OWASP top 10 and SANS-CWE top 25 placements
  • What is Fizzler? A .NET based CSS selector built on top of HTML Agility Pack to parse nodes of HTML by CSS selector. Using LINQ with Fizzler. How does jQuery (client side selector) compare to Fizzler? How is Fizzler able to select out nodes, make changes, and put those changes back? Fizzler and HTML Agility Pack is very powerful when paired together for parsing and modifying HTML nodes
  • How does Jayrock fit into a web developers world? Jayrock is an easy to use way for JavaScript to communicate with back end web services using JSON as the wire format and JSON-RPC as the procedure invocation protocol. Jayrock can generate the client code that is needed for you. Jayrock works with .NET 1.0!! Jayrock is considerably easier to use compared with WCF. Jayrock follows the Duct Tape Programmer mentality of simple and easy to use with rock solid stability
  • BackLINQ "was a pretty bad start" ...but a good story
  • LINQBridge provides LINQ capabilities to .NET 2.0 framework
  • Unit testing is awesome…but not worth updating older codebases that are based on infrastructure
  • MoreLINQ, by Jon Skeet, StackOverflow super star, and author of C# in Depth. MoreLINQ provides 22 additional really useful LINQ methods such as Zip(), ToDelimitedString(), TakeLast(), etc.
  • Open Source works when everyone contributes little bits, be it code, documentation, writing blog posts and articles, etc.

Send me your questions and comments!
If you would like to submit a question to be answered in the next show, please record an audio file and email it to podcast@dotnetradio.com. All you need is a telephone! Call (646) 200-0000, talk, then navigate to http://cinch.blogtalkradio.com/YOURPHONENUMBER to retrieve your recording. Then send it my way.

Friday, November 13, 2009

Podcasting has been more fun than I had anticipated

Going into the whole podcasting adventure was something that I didn’t know if I was ready for or not.  I won’t lie, it has taken a LOT more time than I had initially estimated.  But getting the opportunity to meet and interact with the people that I have has been wonderful.  I thought setting up interviews, given that the site is new, would be difficult.  As it turns out getting people to come on the show has worked out quite well.  So much so that people are now asking to come on the show directly.  Wonderful.

So far I have interviewed Ben Schierman, Javier Lozano, Atif Aziz, and Sara Chipps (in that order). 

Ben’s interview, which largely discussed ASP.NET MVC and surrounding technologies, is already posted

I just finished the rough edit of Atif’s interview which was fantastic (he is reviewing that now).  He has a wealth of untapped knowledge that would take several interviews to get out of him.  We discussed some of his open source projects which touched ELMAH, Fizzler, Jayrock, LINQBridge, BackLINQ, and MoreLINQ among many other interesting things.

The next interview I will be posting will be the interview I had with Javier Lozano.   That interview took us through quite a few details of the ASP.NET MVC framework.  We discussed the existing MVC framework, new features of ASP.NET MVC 2 (preview 2), the MVC Contrib, Javier’s MVC Turbine project (which is awesome),  the MVC controls provider by such vendors as as Telerik and Syncfusion, followed by a quick discussion of the Community for MVC (C4MVC) which I personally attended this last time around and loved!  C4MVC is a must for any MVC developer. 

Then earlier this week I had a chance to speak with Sara Chipps from GirlDeveloper.com.  Sara covered ideas about how to make personal projects a reality.  We discussed her personal project bundl.it which is similar to tinyurl.com except that it gives you one shortened url that points to a container (or bundle) of URLs!  We then discussed some agile practices, jquery, async web pages, and architecting for speed and scalability.  She then told me about a developer chat she created on tinychat.com called WAN party (which was Super WAN Party last night) where several big names in our industry get together for a round table to discuss todays trends.  The key here is that everyone can interact with this folks.  I attended last night and have to say that I was quite impressed.  This was really quite a fun interview and I can’t wait to get it in front of you all!

If you are waiting for the next interview, watch for my tweet from @dnetradio tonight.  I will be posting Atif Aziz’s interview later this evening.

Wednesday, November 11, 2009

Interviewing Sara J Chipps 11 Nov 2009 (tomorrow) at 7am

Hey all.  I wanted to let you know that I am going to be interviewing Sara J Chipps (of www.girldeveloper.com) tomorrow at 7am.  We will be discussing all sorts of programmer goodness from making your personal projects a reality (such as Sara’s http://bundl.it project), agile development, commenting your code, and your responsibility as a developer to the next person reading your code.  We will also be looking at jQuery, asynchronous processes, and architecting for speed and scalability.  And of course, being that we are talking with a …or “THE”… girl developer we will also touch upon what it is like to be a lady working in mostly male dominated industry.

Send in your questions and comments!

If you have any questions for Sara prior to the interview or during it please twitter your question my way and include #DNetRadio in your post. 

You can also record an audio file and email it to podcast@dotnetradio.com. All you need is a telephone! Call (646) 200-0000, talk, then navigate to http://cinch.blogtalkradio.com/YOURPHONENUMBER to retrieve your recording. Then send it my way!

Technorati Tags:

Sunday, November 08, 2009

Just interviewed Atif Aziz for the DotNetRadio podcast

I just got through interviewing Atif Aziz (@raboof on twitter – foobar spelled backwards!) probably most known (at least to me) for his ELMAH (Error Logging Modules and Handlers) contribution.  We discussed ELMAH, ELMAH’s Veracode Application Security Rating which made OWASP top 10 in 2007 and SANS-CWE top 25, Fizzler, Jayrock, BackLINQ, LINQBridge, and MoreLINQ.  Atif is a very smart guy and you can truly hear his passion for sharing with the development community when speaking with him.  This was a great interview that I think any .net developer could learn a thing or two from.  Look for this interview in the near future on the DotNetRadio podcast. 

Subscribe to the podcast feed here: http://feeds.feedburner.com/Dotnetradio

And follow the show on twitter here: http://twitter.com/dnetradio

Saturday, November 07, 2009

Interviewing Javier Lozano 7 Nov 2009 (tonight) at 8pm PST

Hey all.  I wanted to let you know who was slated for the next interview - Javier Lozano

Javier is a .NET consultant in Des Moines, Iowa. He's an ASP.NET MVP and MCSD specializing in ASP.NET, system architecture, and training. Javier is also a co-founder of the Iowa .NET Users Group.

On his blog you can find posts on ASP.NET, architecture, design patterns, .NET, XML and Indigo (WCF). Javier enjoys giving back to the community by speaking at user groups, local/regional .NET events, being active in forums and by writing articles for Code Project.

In his spare time, Javier enjoys spending time with his wife, newborn son , two golden retrievers and writing about himself in the third person.

It is my plan to interview Javier tonight and get the podcast ready for release by the middle of next week.

Got Questions for Javier?

If you have any questions about ASP.NET MVC, Turbine, or anything else you think appropriate for Javier feel free to send them my way at podcast@dotnetradio.com.  The interview will be tonight at 8pm (PST).  Feel free to send your questions in real time via twitter to @DNetRadio.

Interviewing Javier Lozano tonight at 8pm PST

Hey all.  I wanted to let you know who was slated for the next interview - Javier Lozano

Javier is a .NET consultant in Des Moines, Iowa. He's an ASP.NET MVP and MCSD specializing in ASP.NET, system architecture, and training. Javier is also a co-founder of the Iowa .NET Users Group.

On his blog you can find posts on ASP.NET, architecture, design patterns, .NET, XML and Indigo (WCF). Javier enjoys giving back to the community by speaking at user groups, local/regional .NET events, being active in forums and by writing articles for Code Project.

In his spare time, Javier enjoys spending time with his wife, newborn son , two golden retrievers and writing about himself in the third person.

It is my plan to interview Javier tonight and get the podcast ready for release by the middle of next week.

Got Questions for Javier?

If you have any questions about ASP.NET MVC, Turbine, or anything else you think appropriate for Javier feel free to send them my way at podcast@dotnetradio.com.  The interview will be tonight at 8pm (PST).  Feel free to send your questions in real time via twitter to @DNetRadio.

Interviewing Javier Lozano tonight at 8pm PST

Hey all.  I wanted to let you know who was slated for the next interview - Javier Lozano

Javier is a .NET consultant in Des Moines, Iowa. He's an ASP.NET MVP and MCSD specializing in ASP.NET, system architecture, and training. Javier is also a co-founder of the Iowa .NET Users Group.

On his blog you can find posts on ASP.NET, architecture, design patterns, .NET, XML and Indigo (WCF). Javier enjoys giving back to the community by speaking at user groups, local/regional .NET events, being active in forums and by writing articles for Code Project.

In his spare time, Javier enjoys spending time with his wife, newborn son , two golden retrievers and writing about himself in the third person.

It is my plan to interview Javier tonight and get the podcast ready for release by the middle of next week.

Got Questions for Javier?

If you have any questions about ASP.NET MVC, Turbine, or anything else you think appropriate for Javier feel free to send them my way at podcast@dotnetradio.com.  The interview will be tonight at 8pm (PST).  Feel free to send your questions in real time via twitter to @DNetRadio.

Thursday, November 05, 2009

Interview with Ben Scheirman co-author of ASP.NET MVC in Action on DotNetRadio.com

I recently sat down with Ben Scheirman (co-author of ASP.NET MVC in Action) for my first interview on my new show DotNetRadio.  It was quite a talk!  We covered the following points:

  • An introduction to Ben Scheirman and how he got into web development
  • Bens path through various web technologies such as ColdFusion, PHP, Ruby, and ASP.NET
  • A brief discussion on code testability
  • Working with ASP.NET web forms using the model view presenter pattern
  • How ASP.NET MVC simplifies the testing process
  • Ben informs us of how you can sell test driven development to a client…or sneak it in
  • Regression testing
  • We run through the process of refactoring and how you really should trustReSharper
  • We briefly touch upon the concept of Continuous Integration
  • Ben discusses a new way of testing using MSpec to create documentation out of your unit tests
  • This leads us into behavior driven development and context specification
  • Next we discuss how twitter can be used as a developer tool
  • Ben describes to us how he got involved with co-authoring ASP.NET MVC in Action and the process involved with writing a book based on “preview” code.

Check it out at http://dotnetradio.com/.  You can follow the show on Twitter at DNetRadio.

As this is a new show the format is not entirely worked out just yet!  I am still trying to work out the music, the format, guest lineup, advertisers, etc.  Also, since I am a coder by day and a coder/writer at night – pro-audio is a totally foreign concept to me.  I am all ears if after listening to the show or visiting the site you come up with a WTF moment or just some good general advice.  Shoot it my way!

Wednesday, November 04, 2009

Just finished editing the audio for the Ben Scheirman interview

Hey all.  I wanted to take a moment to let you know that I just finished editing the interview with Ben Scheirman as well as piecing together the over all DotNetRadio podcast.  I will write the summary post that goes with the podcast and get it up and available this evening.

Andy

Sunday, October 18, 2009

Interview with Ben Scheirman coming soon to DotNetRadio.com

This morning I had the chance to speak with Ben Scheirman.  We chatted for roughly an hour or so discussing how he entered into the web development industry, going on the road to teach ASP.NET MVC in its early days, his book ASP.NET MVC in Action, and his thoughts on the use of the MVC framework.  We discussed some patterns and tools for testing, tools for development in general such as ReSharper, and the use of the Spark View Engine.  Watch for this podcast to be posted within the next couple of days. 

Being the first podcast for DotNetRadio and the first podcast I have ever done I am hoping that my listeners will share any ideas to improve the show.  I am all ears!  Feel free to share your feedback with me at podcast@dotnetradio.com

Tell your friends about DotNetRadio!  You can also follow us at twitter.com/DNetRadio.

Tuesday, October 13, 2009

DotNetRadio.com

I decided to start a podcast.  I am going to host it under the name of DotNetRadio…sounded appropriate!  I am in the early stages of getting things set up which means that there is still some flexibility in how things are done.  I was wondering if anyone out there is willing to share some input regarding the creation of a podcast, how they might like to see the show format take shape, who they would be interested in hearing an interview of, etc. 

I initially did a test recording using a standard analog mic.  Totally sucked!  So I upgraded to a better quality USB mic.  This certainly made things sound better but it still sounded like I was talking through a can.  Tomorrow I should be receiving the Behringer podcaststudio.  I am hoping that this will be an exceptional upgrade (though still not pro-audio).  This package comes with a good mic, head set, mixer, usb interface, etc.  I also got a pop filter that clips on to the mic (everyone said it is a must).  We will see how it goes.

Take a look at DotNetRadio.com.  Let me know what you think and more importantly if you have any suggestions send that my way too!

Thursday, September 17, 2009

Typemock webinar – Tuesday 22-sep-09

Hey all!  I was just informed that Typemock is providing a free webinar covering the following items:

  • Creating Supporting environment
  • Unit testing tools of the trade
  • Practices and Pitfalls
  • Writing the first test
  • Live Q & A

You can see more details here: http://blog.typemock.com/2009/09/unit-testing-net-successfully-live-free.html

Should be very informative.  (virtually…) see you there!

Monday, August 10, 2009

Building a StackOverflow inspired knowledge exchange

The first article in my “building a stackoverflow inspired knowledge exchange” on DotNetSlackers.com is finally out.  This article is an introduction to the series and explains the various technologies and processes we will use in our project.  It also takes a look at some of the information that is currently on the net regarding the very famous StackOverflow.com site.  More to come very soon.  Keep an eye on the series index here.

Friday, July 31, 2009

Friday, July 24, 2009

I published my first article on DotNetSlackers! “Dynamic email drop box”

I am very happy to say that I have published my first article on DotNetSlackers.com!  While the publication of my book was the first time I considered myself a writer (not just another blogger), writing for DotNetSlackers.com some how feels more important to me.  I hope you enjoy my future efforts!

This article is actually the first of a three part series.  I came up with the idea for this series as I was answering a question on StackOverflow regarding the creation of a dynamic email drop box style feature.  A feature of this nature would allow a site to have their users send content to them or interact with them via a standard pop3 server (via email).  Think of things like the email that craigslist.com gives to you asdfasd-somePost-234@craigslist.com when you post something into their system.  This email doesn’t physically exist but it still somehow identifies your post on their system and allows external users to communicate with you and the system.  The creation of a feature like this (including all the infrastructure aspects) is what the article series discusses and implements.

I hope you find a use for it on one of your projects!

Andrew Siemer
Teacher, Author, Engineer, Architect, Build Master, Scrum Master, Father of 6, Husband, ex Army Ranger

My Book
ASP.NET 3.5 Social Networking:
An Expert Guide to Building
Enterprise-ready Social Networking
and Community Applications
with ASP.NET 3.5



Links
Blog.AndrewSiemer.com
AndrewSiemer.com
StackOverflow.com
PictFresh.com
Linked In
My Space
Face Book
Twitter
AndrewSiemer.GymEd.com
GymEd.com

Tuesday, June 23, 2009

Review: ASP.NET MVC in Action by Jeffrey Palermo, Ben Scheirman, and Jimmy Bogard

The ASP.NET MVC framework was just released as a preview when I started to write my first book (ASP.NET 3.5 Social Networking).  In the early days of design decisions for my book I was faced with the problem of building with the MVP pattern or the new MVC pattern/framework.  At that time there was next to nothing regarding the use of  the ASP.NET MVC framework (proper or improper). 

Shortly after I got started with my project (which I chose to do in MVP) I was asked to do a review for the ASP.NET MVC in Action book.  I gladly accepted and started to read as Jeffrey Palermo, Ben Scheirman, and Jimmy Bogard explored the world of ASP.NET MVC offerings.  I thought that they did a very good job of describing how Microsoft meant you to use the new framework and a better job of describing how to break beyond the limitations of the current offerings.  They go above and beyond to describe best practices early on.

ASP.NET MVC in Action

I must say that this is one of the few books that I have ever read cover to cover so many times!  With each review of the book I went through each chapter to find any updates.  As this book was being written several new CTP’s of the ASP.NET MVC framework were released.  With each of the CTP releases came a new rendering of the book.  It was quite fun to see how quickly things changed over the year that this book was written.

Finally having the final review in my hands and being so very familiar with it’s content, I have to say that of all the books on the ASP.NET MVC framework the ASP.NET MVC in Action book should be at the top of your list for things to purchase in the upcoming months.  At a quick glance this book covers all things relating to ASP.NET MVC and then some.  This book is not just a regurgitation of MSDN or other resource as so many books are these days.  Here are the chapter titles for this book:

  1. Getting started with the ASP.NET MVC Framework
  2. The Model in depth
  3. The Controller in depth
  4. Views in depth
  5. Routing
  6. Customizing and extending the ASP.NET MVC Framework
  7. Scaling the architecture to more complex sites
  8. Leveraging existing ASP.NET features
  9. AJAX in ASP.NET MVC (which includes coverage of jQuery!)
  10. Hosting and Deployment
  11. Exploring MonoRail and Ruby on Rails
  12. Best Practices
  13. Recipes

As you can clearly see from the above this is more than just the XYZ of ASP.NET MVC.  I highly recommend this book for anyone interested in breaking away from the pains of ASP.NET WebForms.  This framework, especially with the help of this new book, makes programming for the web fun again!

 

Andrew Siemer
Teacher, Author, Engineer, Architect, Build Master, Scrum Master, Father of 6, Husband, ex Army Ranger

My Book


Links

Thursday, May 28, 2009

NDepend review – code evolution achieved by following NDepend metrics

The people behind the NDepend software recently provided me with their latest version of NDepend to see what I thought.  I initially ran the package over one of my recent projects and found that the reporting offered in the latest version of NDepend was infinitely better than the previous version (1.0) that I worked with.  I found the reports that NDepend was offering would be most valuable while building my latest project.  For this reason I started my latest project in a manner that would leave much room for improvement. 

My application in the beginning

The project that I am going to run NDepend over to help me catch mistakes as I develop is built in ASP.NET MVC, LINQ to SQL, and following Domain Driven Design.  I specifically didn’t follow most of the SOLID principles to see how well NDepend would allow me to catch and correct my deficiencies.  To start off I am using the standard Model View Controller concepts and have stuffed all of my business and data access layer into a separate assembly project.  I am building a services layer, have specific domain objects (generated by LINQ to SQL), and am using the Repository pattern.  Beyond that I am new’ing up class references, not creating interfaces for anything, and am lumping generic concepts into generic classes.

With that in mind I ran NDepend over my initial code base and was given the following reports (there is a lot more information offered…but we will start here):

image

image

VisualNDependView

AbstractnessVSInstability

ComponentDependenciesDiagram

image

What does all of this mean?  I took a look at this cheat sheet (http://www.hanselman.com/blog/content/binary/NDepend%20metrics%20placemats%201.1.pdf) to begin to decipher all of this information.  On our abstractness and instability chart my code is currently showing as being very concrete and very stable!  This is not a bad zone to be in (my code is neither painful or useless).  <GRIN>  Also, when looking at my dependency graph you will notice that for the most part (MOST PART) my presentation layer is only communicating with the sub system through my business layer.  Some of my code is generated (LINQ to SQL) or part of a framework (ASP.NET MVC) which means that there is not a whole lot I can do in some regards.  And we can clearly see in the metrics section (all the gradient squares) that some areas have a lot more code dedicated to them than others.  Finally we have a list of high level warnings (yellow sections of the CQL) that may benefit from closer inspection.

Since I have a nice baseline of my application built in a standard tiered manner but not following my normal development avenues (SOLID), I am going to first avoid the direct output of these reports and add in a couple of my normal design decisions to see how it affects these reports.  I am first most curious to see how implementing StructureMap will help me here as it will force me to generate interfaces for all of my classes as well as remove all the static dependencies in my code.  Also, once I have StructureMap implemented it will be easier to do things like Inversion of Control and Test Driven Development. Implementing StructureMap will help us get closer to the concept of the Interface Segregation Principle.  Once that is done I will rerun the reports to see where we are.  Then I will implement Inversion of Control (IoC) to see how that impacts things.  My next step would be to refactor my code so that it follows the Single Responsibility Principle (but in the effort to get this post done…I may push that to another article!).

Application after StructureMap

Once I added StructureMap into my source code for all the references that I could I started to find myself moving up the scale of “uselessness” but no closer to “abstractness” (which makes sense).  The change that was made was that rather than saying Object o = new Object() I am now generating an interface (with ReSharper) for the Object and then declaring an instance of the object using StructureMap using syntax like IObject o = ObjectFactory.GetInstance<IObject>().  This basically means that pretty much everything has an interface defining it’s usage.  Also, with StructureMap I can swap in mocks when testing.  This makes my code much more flexible down the road (more flexible apparently equals more useless).  An example of this flexibility is that if I want to use the standard .NET Cache initially I can.  Then later I can swap in a new MemCache object simply by injecting the new object everywhere that ICache is called for via StructureMap.  This is done with a couple of lines of configuration code in the StructureMap.config file…lots of power here!

Before (StructureMap and interfaces not used):

image

After (StructureMap implemented where possible, interfaces used where appropriate):

 image

Here are the other items to look at.

image

image

image

image

image

Having done my best to start following the Interface Segregation Principle I am now going to turn to my next favorite pattern/principal by implementing Inversion of Control (or the Dependency Inversion Principle) and see what improvements that gives us.

My application with Inversion of Control

In order to apply inversion of control to my application I will be taking all of the instantiations out of my methods and moving them out to parameters of a method or passed in via the constructor.  Now that I have StructureMap sewn into the application I can take advantage of some of its power in that if it sees an interface being specified in the constructor of an object that it is instantiating, it will go ahead and pass in the appropriate instance of that required object. 

For example, prior to doing IoC I had a repository class that would work with accounts (AccountRepository).  It would instantiate an instance of the Connection class internally and then do the work it needed to do to connect to the database and grab the appropriate account related data.  This means that the Connection class and the AccountRepository class were very strongly coupled to one another.  Some of this coupling in the same layer is not horrible…but in this case every single repository in my application would be coupled to my Connection object which over time would rapidly become a very large number.

We can easily fix this scenario using StructureMap in that we can require IConnection be passed in via the constructor of each repository class.  Then when we instantiate a repository object StructureMap will take care of passing the appropriate Connection to the Repository and we are off and running.  This removes the need for users of the Repository to be aware of which Connection object to use and reduces coupling considerably.

I will apply this concept to the entire application and see how that affects things in NDepend’s eyes.

Argh!  There was no physical change to my NDepend reports simply by implementing IoC!  NDepend looks at coupling across assemblies but not inside the assembly (at least I don’t see that anywhere).  No worries!  This addition will help down the road when it is time to start implementing our unit tests.  Not a total loss.

Addressing the canned CQL Queries and Constraints

Ok, let’s dig into some of the CQL Queries and Constraints to see if we can affect change that way.  The yellow sections of this report are the areas that need attention.

image

Lets start off with the Encapsulation warnings (section in red above).  In the Visual NDepend interface I can see the following warnings.

image

By double clicking on the first item “Methods” I see the following list.

image

Here you see specific suggestions to make my code more compliant with rules of encapsulation!  Double clicking the first problem area “Methods that could be declared as…” I am presented with this list.

image

Double clicking on any of these method names takes me directly to the code (in Visual Studio) that needs help.  From there I can dig around to see about making the suggested changes.  In some cases I see where I could indeed mark something as “internal”…however the suggestions that are being made are simply because nothing external to the assembly is calling the specific method.  Unfortunately for me I frequently import libraries and tools from past projects knowing that I will need to use them eventually.  In my case most of the suggested items that need to be fixed are items that are waiting to be used rather than items that need to be marked as internal! 

I continued to poke through their list of suggestions and found that while the suggestions are good, they are not always 100% appropriate.  This means that I will have to learn to live with some of these yellow cautionary sections as I can’t get them to go away (without mangling their CQL queries…which may apply at a later date)!

NDepend is super flexible!

Now that I have been using this product for a while, and have started to bump my head against it a bit, I am starting to find that this product is actually very flexible!  For example there is a query for for naming standards I have started to bump my head against.  I like to use an underscore to denote my private fields in a class.  NDepend would prefer that I use m_ instead.  To change this is quick and easy.  I simply locate the rule that bugs me, double click on it, make the change in the CQL query editor, and save the changes.

image 

image

I made the changes to the query above so that it now looks like this:

image

This goes for all of the rules that are in this product which means that I can add and remove rules as I see fit!

Monday, May 11, 2009

Social Networking in .NET

I finally posted the code from my book ASP.NET 3.5 Social Networking on CodePlex at  http://community.codeplex.com/.  Several people have asked for this so that we can make changes to the code and improve/expand the code base.  I think I may also take the time to convert it from the MVP pattern to the latest ASP.NET MVC pattern/template as well as add test coverage the project.  I also set up a forum for this at forum.socialnetworkingin.net and a separate blog at blog.socialnetworkinging.net.

Thursday, May 07, 2009

SOLID principles explained in a visual manner

If you followed any of the banter regarding the SOLID principles between “uncle” Bob Martin and Joel Spolsky you may have also already seen the SOLID development principles in motivational pictures.  If not follow through all the links listed here.  The last one has the pictures.

Simple podcast outlining the SOLID principles: http://www.hanselminutes.com/default.aspx?showID=163

Jeff Atwood, Joel Spolsky, and “uncle” Bob Martin discuss SOLID: http://itc.conversationsnetwork.org/shows/detail4012.html

Hanselman’s follow on interview with “uncle” Bob Martin: http://www.hanselminutes.com/default.aspx?showID=168

The best thing that came from all of this is the following pictures from LosTechies:

http://www.lostechies.com/blogs/derickbailey/archive/2009/02/11/solid-development-principles-in-motivational-pictures.aspx

Wednesday, April 22, 2009

Huagati DBML/EDMX Tools

Anyone that is working frequently with either LINQ to SQL or the Entity Framework needs to go get a copy of the Huagati DBML/EDMX tools.  They plug right into Visual Studio (2008) and allow you to perform many of the tasks that you would think VS would do for you.  I just recently had a new dev db get corrupted.  I had no backups for it.  I also had no scripts generated for it.  Argh!  What to do?  With this tool I was able to reverse engineer my EDMX file and spit out all the SQL I needed to generate the database.  There are many other features provided with this tool that I am sure you will love too.

This tool is offered in a free 30 day trial.  Then there are a few paid versions.  I think that the professional version is worth the $120 price tag but there is a $50 version and a $12/mo subscription option.  Very good stuff!  Go grab a copy.

Thursday, April 16, 2009

Friday, April 03, 2009

Word Press Tag Cloud to be reused across other tag-able systems – WP Cumulous

I was scooting about the net the other day and landed on someone’s site that had the most fascinating tag cloud I have seen so far.  The tags in this cloud revolve as though they are in a 3d sphere.  When you mouse over the sphere you can move the words up down and around.  Very interesting.  This is a flash based control that you can feed with an XML file.  Also, the source for it is readily available which makes it a tool that can be ported to just about any tab based platform.  Very nice!  See the home page for this widget here or get the developer (source) version here.

image

Monday, March 30, 2009

ILOG Rules for .NET 3.0 – quick overview

I have been working on a project for the past year or so.  This project was originally decided to be implemented in a BizTalk environment.  Although most of us were new to this form of SOA development we went ahead with the understanding that we would eventually learn enough to stand up, manage, and develop for BizTalk.  With this in mind we developed our entire application in such a way that we thought the app would simply plug in to the BizTalk environment (from an orchestration point of view any ways).

Some of the reasons that we decided to go with BizTalk was that it was very scalable, configurable, flexible, and that it had many components that we could easily use in our application.  Some of these components were the Business Rules Engine (BRE), various reporting tools (BAM), built in queue integration, etc.  We liked the idea of using already built and tested components.  Why recreate the wheel after all?  After we played with BizTalk for quite some time, took several classes, and spent many months with our BizTalk consultants, we eventually heard one statement that summed up BizTalk in every way:

“BizTalk can do anything you want it too, it just can’t do anything out of the box!”

Whaaaaa?

Any ways…again…a year later I am still working on an application that needs some of these BizTalk style components.  One of which we have found is needed more and more.  We needed an external program to manage the flow of our application.  One might immediately jump to Windows Workflow Foundation and the Rules Engine that comes with WWF.  However, one of the marching orders of this application is that the business users can make changes to the logic of the application in such a way that it doesn’t require a code push and is not restricted by the length of a development cycle.  We had looked into several rules engines along the way to see if any were capable of addressing this need.  All of the rules engines that we came across were Java based and forced you to integrate with them via web services.  Yuck. 

We eventually came across ILOG Rules for .NET.  This is a program (now owned by IBM and a Microsoft Gold partner) that integrates into a .NET developers world in a very seamless manner.  It plugs right into Visual Studio allowing the developer to define flows, express facts to rule editors, verbalize those facts in a more business friendly manner, and call into the execution server to run the rules all without any headache at all.

image

In addition to that the rules, decision tables, and flows can be edited externally in Microsoft Word or Excel.

image

image

And for those in a real Microsoft shop you probably have a SharePoint installation to manage all of your documents.  SharePoint is also fully integrated into this suite for rule doc management, workflow management, etc.  (sorry, no screen shot of this yet)

The best part of this application in my mind is that ILOG gives you a 6 month free trial of the fully functional suite!  This means that you can easily knock together a proof of concept before you purchase their (very reasonably priced) program.  http://www.ilog.com/dev/brms/rfdntrial/  And another benefit to their free trial is that they provide you will full access to their support forum.  I had a few issues during my POC development that I got pretty quick help with through this online help format!

In future posts I will show my proof of concept and address some of the gotchas that I ran into.

I am going to assume that you can get through their registration and free trial download process.  I am also going to assume that you can get all of their programs installed and running (they cover that pretty well). 

One word to the wise – do be sure to install the execution server first so that you don’t have to mess with any configuration files down the road!  This should be pretty easy as it is the first installer you come across.

Also, be sure to read through their various documents and white papers (with the QuickStart being the most helpful!):

Quick Start C:\Program Files\ILOG\ILOG Rules for .NET Quick Start 3.0\Documentation\QuickStart.pdf
White papers http://www.ilog.com/products/rulesnet/whitepapers/
Online help http://docs.ilog.com/brms/documentation/rulesnet30/

Friday, March 27, 2009

Entity Framework : An entity object cannot be referenced by multiple instances of IEntityChangeTracker.

I just had this error where entity framework was complaining about my object already being referenced by the data context that I originally got the object from.  In LINQ to SQL I guess this was just taken care of for me.  I would get the object in a using statement so that the data context was cleared when I was through with the context.  Then I could do what ever I wanted to with the object after that – to include throwing it back to the database.

I came across the fix to this issue here: http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/501d7b99-0cb9-44b6-b2cd-16275a151b31 which simply suggests detaching the object from the original context before I kill that context.  Then I can re-attach the object to a new context later on.  This solved the issue…but uncovered more issues.

Here is my post to the MS forum:

-----------------------------------------------------------------------------------

Working in a web app I am very fond of the Repository approach.  I generally create a new context inside a using statement which then kills the context for me once my snippet of work is complete.  So for an AccountsRepository I might have a Save(Account account) method which would have something like the following:

using (RanchBuddyDataContext dc = new Connection().GetContext())

                {

                    if(account.AccountID > 0)

                    {

                        dc.Accounts.Attach(account, true);

                    }

                    else

                    {

                        dc.Accounts.InsertOnSubmit(account);

                    }

                    dc.SaveChanges();

                }

While this worked great in LINQ to SQL I am finding that it doesn't work so well with the Entity Framework.  I am now getting the error that started this thread.  In order to address this problem I have to do a few things and am not liking the work that goes into this.  Hopefully someone can adjust my way of thinking on this.


For my particular issue I have a person that logs into the system.  Once the log in is correct I stash their account object (fairly light) into their current session.  I then refer to that now and then as needed.  This works great.  However, when the user goes to the edit account screen, I would normally load the screen with their session held Account object.  Allow the user to edit their data and then throw it at a repository method as descibed above.


Not any more!


Up to the point where the user logs in is unchanged.  However, the object that is returned to me by my login method now has to be detached from the context - a step that I must remember any time that I want to keep and object out of the db, fiddle with it (edit it), and then eventually persist it back to the db.  Then it is put in the session for later use.  Once the user edits their account I have to get an original copy of the object (I am guessing so that the context is aware of it???) and then attempt to persist my object (with changes) back to the db.


I now have this code for getting the Account by username:

public Account GetAccountByUsername(string Username)

        {

            Account result = null;

            using (RanchBuddyEntities dc = connection.GetContext())

            {

result = dc.AccountSet.Where(a => a.Username == Username).FirstOrDefault();

                dc.Detach(result);

            }

            return result;

        }

If the account that is returned from a username search matches the supplied password then the account object here goes into my session.  Notice that at the bottom of my query above I have a dc.Detach(result) statement to remove it from the context.  From what I have read so far I have to do this so that I can re-attach it later on or keep a copy of the original object with me everywhere I go.


Then comes my save code.

using (RanchBuddyEntities dc = connection.GetContext())

                {

                    if(account.AccountID > 0)

                    {

                        Account original = dc.AccountSet.Where(a => a.AccountID == account.AccountID).FirstOrDefault();

                        dc.ApplyPropertyChanges("AccountSet",account);

                    }

                    else

                    {

                        dc.AddToAccountSet(account);

                    }

                    dc.SaveChanges();

                }

In this code I now have to get the original object into the context (as I don't carry the original object around with me just in case I need it and I guess the context is not aware of it if I don't manually load it??), then ApplyPropertyChanges of my updated object, and finally SaveChanges() on the context.


I would love to hear if anyone has a better way of working with this.  I much prefer the way I was able to do this in LINQ to SQL as there were less steps to remember and I didn't need to litter various methods with snippets so that one method would work correctly with another (when they shouldn't care about each other at all).

-----------------------------------------------------------------------------------

I would love to hear of a better solution to this problem that shouldn’t be a problem.

 

 

Copyright © Andrew Siemer - www.andrewsiemer.com