Category Archives: Design

An IoC Conundrum: Looking for feedback

Today at work, my boss and I were brainstorming on the best way to use IoC across all our code. During this, he proposed an idea for using IoC that at first made me feel uneasy with the way it was being used. But the more I think about it, the more I am amazed by its design. Let me set this up for you and the best way is with pictures.

Note: The code examples given here are not functional and just provided to give a rough idea of what is intended.

Explanation: 

  • The BaseLib is a library that contains all the interfaces we define. It also contains the CDepInjection class.
  • The CDepInjection class contains a static Register method that will find an assembly that corresponds to an interface and using Reflection, load it.
  • The Database library contains a CDatabase class with a static constructor that will be called from the previous step when the Database library is reflected and loaded. See image below.

Benefits:

  • By having all the interfaced in BaseLib, we are programming against an interface.
  • By having the CDepInjection class in BaseLib, there is only 1 place we need to update code and only 1 dll that we will need to deploy in production should changes be needed. (Note: We could have 100 servers running 100 application each and they may be windows services, web services, asp.net mvc apps, windows forms apps, console apps etc.).
  • By making a change in CDepInjection and telling it to map an interface name to the appropriate assembly and class and having the RegisterType be in the CDatabase class, we can create a new database class, CNoSqlDatabase in another assembly, deploy it, make a change to BaseLib by telling it to now map IDatabase to the CNoSqlDatabase and then deploy that to all our servers GAC. Now, everything will use the new CNoSQLDatabase.

Concerns I have:

  • Using a static constructor in CDatabase means that it will be called one per process and only when the assembly is loaded in the Register(..) method of CDepInjection. I’m not convinced that a static constructor would be the best thing to do. In essence, aren’t we just abstracting the mappings that would go in a config file and putting them into BaseLib instead of an app.config of BaseLib?
  • Resolving parent-child would necessitate having to call register in the ‘main’ method of all our applications. For instance, if CDatabase was going to need logging, it would have to call Register(“ILogging”) in the static constructor above the Container.RegisterType<IDatabase, CDatabase>() call.

I would very much appreciate a critique of this design. Thank you.

Advertisement
Tagged , , , , , , , ,

Standing Desk for Tall People and Multiple Monitors

I’m a tall person and like many developers, I sit. A lot. I’ve been feeling a pain in my back for some time now and I’m determined to do something about it. As usual Scott Hanselman has already been there and done it for you. Buy this man a beer and find a way to keep him alive. He’s our Obi-Wan. OK! Enough gushing.

  1. Exercise. I plan to work out 3 times a week during lunch so as to strengthen my core.
  2. Eating. I already eat health. I weight myself everyday, allowing for slight variations that tend to occur. The idea is to notice any drastic changes. I lost 15 pounds in 1 month due to a thyroid storm but luckily it was temporary.
  3. Standing and Posture. Sitting, hunched over at ill fitting desks and chairs has been my undoing. There have been lots of studies and developers talking about how switching from sitting to standing has helped them so I won’t bore you with the details. Needless to say, tall people are SOL when it comes to office furniture (unless you happen to work at a very nice company that makes an effort to adhere to ergonomic standards).

Did I mention I code? That’s important because we’re inherently lazy (hence the back pain). So, I researched some standing desks. Then I researched some that would fit me. Geekdesk has really nice desks and I was willing to splurge on a desk but waiting 6-7 weeks for it to ship and then paying 300+ on shipping is just not worth it.

Did I mention I’m lazy? That’s important. Because laziness breeds invention. Over my lunch break today, I finally had enough of my back pain and decided to just make my standing desk, even if it is just boxes stacked together in Jenga form. I walked around the house and found 2 things that could immediately help me.

  1. Expedit Workstation – http://www.ikea.com/us/en/catalog/products/S99861340/#/S19861339
  2. Lack Coffee Table – http://www.ikea.com/us/en/catalog/products/40198396/#/20198397

Stack these two together and you get a standing desk that works for a tall person (> 6′ 4″). Benefits include:

  • Simple
  • Works for tall people
  • No carpentry required
  • No separate keyboard tray necessary
  • No furniture destroyed (easy to put the coffee table back when guests come)
  • Supports Dual Monitors (multiple monitors is the only way to work and any solution you use should utilize this)

Standing Desk For Tall people with Multiple Monitors
This is what the result looks like. The laptop is below the desk and makes it easier to sit down when I need a few minutes to rest. I do hope you get to utilize this multi monitor solution. If you’re still hell bent on carpentry and building, take a look at the IKEA Hackers page.

//ToDo Look into getting some cushioning for the feet. I used a yoga mat today and it felt great. Only problem is that my feet started sticking on the mat after an hour. Donn Felker recommended the GelPro mat in one of his tweets and I might need to look into that too.

Tagged , , , , , , , ,

MSDN Blogs: A Look at How I Would Improve It

I was browsing through MSDN blogs after a very long time and I noticed a couple of things that seem very odd. Needless to say, there are some things I love about the blogs such as the richness of content and smorgasbord of people for various cultures. Now as I go through this, please remember I am not an expert or a professional critic. These are just a few suggestions that in my mind would make sense.

Design Issue 1: No Filters By Language

When looking through blogs, seeing a whole page of content I am unable to parse only prevents me from getting to the content I’m looking for.

image

Design Issue 2: No Filters by Tags

As a user who has just showed up to the site and doesn’t have an account or doesn’t want to set one up, there should be easy filters provided such as Tags. They don’t exist anywhere but on the individual bloggers site as far as I can see.

Design Issue 3: Leaderboards are slow to load

I have seen this take a few seconds to load up and in a Web 2.0 world this is really not the best. Slow loads should be cached and performance in general should be tuned. The slower the page loads, the easier you make it for readers to get agitated / bored and go away.

image

Design Issue 4: Leaderboard ranking numbers

These numbers are HUGE and distracting. Also they are right next to other icons and information that clutters the page and makes reading much more difficult.

image

Design Issue 5: No use of Keyboard keys

image

If you use paging, especially in a blog, allow your users to use keyboards for navigation. See my piece on Keyboard UX For the Web.

Design Issue 6: Menu Incongruity

Notice the difference in these images below. When in the blogs, the text shows up in the menu. And when I click on home, the blogs link goes away. Standardize the menus across MSDN so as to promote it and provide uniformity to the end user.

image

image

I may be too critical here but it seems that the blogs need more focus on data management and presentation. The whole point of having a blog system the size of MSDN Blogs is so you can present information from your developers / other employees straight to the readers / potential hires.

Things I would change

1. Remove Leader Board and Commentator list from the pages.

Make it a link if necessary but don’t waste so much space.

2. Make appropriate use of space.

If I have a 1920 x 1200 resolution, use that space. Also, limit the scrolling one must do if you are going to use paging. Show a single page worth of information and allow the end user to navigate through the list easily.

3. Provide appropriate tags and filters.

If I am looking for information on Marketing or Human Resources, how do I get to it. Segment your content on at least this basis:

  • Country / Region
  • Language
  • Department / Product Area

Once you do that, provide landing pages for certain departments. By doing this you increase the likelihood that readers specific to HR go there more often.

4. Open Data.

Provide this information as OData or some other format that your readers can use. I would envision some great blog reader apps for the Windows Phone 7 Marketplace that worked off this principle.

5. Featured Blogger.

Introduce your featured bloggers to your readers based on the filters they choose.

6. Utilize keyboard navigation.

Your audience is going to be very technical. Give them the tools to navigate your site and limit the time it takes them waiting for loading and clicking.

7. Improve search.

The whole point of the system is to allow users to find data quickly. Perform a search for ‘human resources’ and the first thing to show up relates to Great Plains. Make search more friendly and useable.

8. Prioritize.

Some posts are more useful that others. Bloggers highlight those in a best of category on their pages. Provide a best of category that depicts the top posts of a blogger. Then, let me explore your bloggers by their name and their content. It will allow me to clearly get a feel for what content they produce and whether they are something I would consider following more closely. Something like the image below but scrollable left and right (mouse + keyboard). (Note: image below is an example created using paint. Its jus supposed to convey a look that content slides would be.)

image

9. No Limits.

Never limit the level of content your bloggers can provide. Ever! I ran into this today and it’s not likely that I will follow through to the new content unless I’m desperately looking for something. ‘We blog too much!’ Reward these people somehow. Show them that their time is appreciated.

image

10. Help me.

As a new user to MSDN Blogs, imagine going to the site and seeing the list of Leaderboards. Then as you move your mouse, OH LOOK! The names are links. That was not obvious to me. Ok Click the name. OMG! That is a great stats page. How would I have known to do that. It wasn’t obvious the last few times I came to the site.

image

I’m sure this is already obvious by now but the help needs more content. There are 6 items written and its just not enough. Here is what Popular topics should look like according to the help.

image

And here is what it actually looks like right now.

image

So with that I’d say I’ve been a big enough ass to the fine people of MSDN Blogs. I hope they see this as a means of improving what is already a fine section of MSDN. And if I can offer my help in any way, please let me know.

Tagged , , , , , , , , ,