Tuesday, October 6, 2015

Service Layer Design Pattern: To use or not to use?

Quite often, I had been confronted with questions on the need for development teams to use service layer pattern in their applications. The short answer, if your product scope does not demand the need for a service layer pattern, then you probably should not use it until you reach a point in the product life cycle when it makes sense to have a service layer pattern. I have found the following explanation particularly impressive regarding the use of service layer pattern:
 
There are many factors that go into the decision of creating a service layer. I have created service layers in the past for the following reasons.
  1. Code that needs to be re-used by multiple clients.
  2. Third party libraries that we have limited licenses for.
  3. Third parties that need an integration point into our system.
  4. Centralizing duplicated business logic.
Case 1: You are creating base functionality that needs to be used by a myriad of different clients. Service layer builds in functionality for different clients to tap into your provided functionality right out of the box.
Case 2: You normally host code in app space but you are using a third party library that you have limited licenses for. In this case you have a resource you would like to use everywhere, but only a limited number of them. If you host it behind a service then your whole organization can get usage of it from their applications without having to buy a license for each individual hosting.
Case 3: You are building functionality for third parties to communicate to you. In your example you could set up an inventory endpoint to allow vendors to pass messages to you about incoming product shipments.
Case 4: You have analyzed your code enterprise wide and found that separate teams have created the same thing (just implemented slightly differently). With a service layer you can pick the best approach(es) and now you can implement the process the same across all teams by having them call into the service. Another benefit to centralizing logic is when bugs are found. Now you can deploy the fix once and all clients enjoy the benefit at the same time.
All this being said there are potential negatives to a service layer.
  1. Adds system complexity. Where before you only had one application to debug now you have two. Production problems require checking client app setting, service app settings, or communication problems between otherwise correctly setup client and server apps. This can be tricky if you've never done it before.
  2. One point of failure. If you have a service outage all clients are affected. When code is not deployed in this manner the risk can be less (though there are ways to mitigate this).
  3. Versioning can be harder to do. When you have one app using a service deploying interface changes can be done at the same time between the two. When you have multiple clients now you must manage who is on V1, who is on V2, and coordinating the removal of V1 (once you know everyone has updated to V2).
The main point is that it's not always a slam dunk to make your system service oriented. In my experience it usually is a good idea (I tend to structure applications in this way), but it's not an automatic decision. At the end of the day you need to weigh the pros and cons and make the decision that's right for your situation.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

Monday, August 10, 2015

Unity3D - Roll a ball tutorial review

This is my first foray into game development and Unity 3D, I must admit, is a darn good gaming platform to get your hands dirty. In less than 30 minutes, I was able to get the ball rolling on my very first game board. The Roll-a-ball tutorial was very descriptive. However, there are some points that are not explicitly mentioned in the tutorial which could be helpful for a beginner to get going.
 
How to get the ball moving:
It was not evident in the tutorial that the player needs to use the arrow keys on the keyboard to get the ball rolling. Took me a couple of blogging sites to figure that out.
 
How to get the game view(or camera view) in sync with the scene view:
The tutorial starts off with showing the game view as an exact replica of the scene view. However, the Unity version 5 that I installed does not sync both the views by default leaving me wondering where the play ground is when I tried playing the game for the first time. For starters, you can do the following:
1) Select the "MainCamera" object in the "Hierarchy" tab.
2) Go to "GameObject" menu item in the tool bar.
3) Click on the option "Align to View". This will align your game view to the scene view.

How to get the  scene view in sync with the game view(or camera view):
Further down the lane, as I was playing around with the scene view, I got it all messed up. Now, I wanted the scene view the way it was. I could see that the game view and the camera view remained unchanged - the way I wanted the view to be. Here is what you need to do:
1) Select the "MainCamera" object in the "Hierarchy" tab.
2) Go to "GameObject" menu item in the tool bar.
3) Click on the option "Align View to Selected". This will align your scene view to the game(or camera) view.
 
Unable to see your changes:
For those who are used to Visual Studio IDE, you would expect that your changes are automatically saved and compiled when you hit the "Run" button. However, in the case of Unity, any changes you make in Unity have to be explicitly saved before you run. I have made the mistake of restarting my PC after making several changes. While I was expecting that my changes will be auto saved or auto recovered or at the least I would be prompted to save my changes, I had lost all my changes post reboot.

Setting up the play area - Walls do not fit the play area as per the dimensions followed in the tutorial:
This is because the play ground in the tutorial is twice the size of what we have by default on our editor. Scale the playground to twice the size along the x and z axes.

 
More to come... Will keep you posted!

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

Thursday, June 12, 2014

So Long Scrum, Hello Kanban

The Kanban Philosophy:
  1. Engage your resources as and when the need arises, not necessarily redeploying them.
  2. Focus is on the value realized and not on the individuals. i.e., do not just focus on whether each individual team member is kept busy or not... which is what traditional agile methodologies seem to lead the focus to.
  3. Mental shift for ICs: “What am I doing?” to “What is the work that we are aiming to accomplish?”

References:
http://channel9.msdn.com/Series/Using-Kanban/
http://blog.nwcadence.com/dont-miss-using-kanban-jumpstart-today/

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

Friday, November 15, 2013

JAXDUG meetup on ASP.net SignalR : Key takeaways

  • A project that started off as an open source that is now part of the official .NET Framework 4.5.
  • An Server Side ASP.net functionality to push content out to the browsers(clients). This allows real-time web updates to the browsers.
  • It is officially part of the HTML5 specifications.
  • Supports WebSocket implementation.
  • For SignalR to use WebSocket, IIS8 and Windows Server 2012 or Windows 8 is required.
  • SignalR Hubs API allows us to make remote Procedure Calls(RPCs) from Server to Client and vice versa.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

Monday, November 11, 2013

ASP.Net Troubleshooting

  • Troubleshooting 503 “service unavailable” errors:
A common “what the hell just happened” error is the plain 503 “service available” error that looks like this:
 
While there may be several reasons why this may occur, in this specific case, the 503 error was occurring because the Application pool failed to start. This was because the password was changed recently for the  Identity under which the application pool was trying to run. Fix was to go to the IIS Manager-> Application Pool -> Advanced Settings -> Process Model -> Identity and set the password to the new one.
 
It would also help to check the Event Viewer Logs(Event Viewer (Local) -> Windows Logs -> Application to look for specific causes of failure before proceeding to troubleshoot any further.
  •  'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine error:         
This issue happened because of missing drivers to access OLE DB and also the fact that the drivers are not compatible with 64 bit OS. Follow the following steps to fix this issue:
1. Install Microsoft Access 2010 Database Engine from http://www.microsoft.com/en-us/download/details.aspx?id=13255
2. Go to the website's application pool in IIS, choose advanced settings, and set Enable 32-bit applications to FALSE.
3.  Restart the website.
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

Monday, October 28, 2013

Windows Communication Foundation - Gotchas

Gotcha: Server is always receiving a NULL value parameter though the client is sending the appropriate data. Method signature in the proxy and wsdls seem to be correct.
Solution: Look for the name of the parameter in the generated wsdls. WCF does a string comparison of the parameters, therefore, watch out to see if the wsdls and the generated proxies have an exact match even in the parameter names. A trained programmer mind might often overlook this fact since in the world of computer programming method signatures matter and the actual parameter names are irrelevant.

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>

C# - How to change Date in Visual Studio Debugger

1. Set the breakpoint
2. Open your DateTime variable in QuickWatch for example (right click)
3. In Expression text box enter new value, this is example if your variable name is "dt":
dt = dt.AddDays(3) or DateTime.Parse or new DateTime()
 4. Press enter and continue executing project

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6962084931129525"
     crossorigin="anonymous"></script>