The most valuable Asset – Agile team – Rules

General

  1. Be conscious of your current level of productivity and happiness and make continual changes to grow.
  2. People are at their best when they are healthy, energized, focused and at ease. Design your day to day activities to enrich your mental, physical and professional selve.
  3. Work on yourself just like you do on a project. Plan the necessary disengagement from the project just as carefully as you’d plan the time you work on it. If you can systematically improve and expand your skills, then whether the project works out or not, you’ll always be in an increasingly better position as the weeks and months pass.
  4. Share early in the decision process to avoid big revelation.
  5. Focus on listening rather than responding. Take the approach that everything is a hypothesis and you could be wrong. You are suggestive rather than instructive, replacing phrases such as “certainly”, “undoubtedly” with “perhaps”, “I think” and “my intuition right now”.
  6. Talk, code, design and write in a clear way instead of being clever.
  7. Admit when you are wrong.
  8. Respect each other’s time and space, if someone has their headphones on don’t physically disturb them, ping them on Chat or through another onilne medium, create a task if you have a question.
  9. Make decisions based on facts over rank.
  10. Open to be responsible over blame culture.
  11. Remove any negative thoughts over the coffee/ tea or a beer – we are family.
  12. Open to change. We may know what is right but may be there is a better way to do something.
  13. Wake up fresh and work with clear and focused mind over working that extra hour in the end of the day. Always aim to be fully engaged in an activity or rest instead. Focus on expanding the capacity of your mental, physical, emotional and spiritual energy (yes, spiritual).
  14. It is everyone’s responsibility to make every day fun.
  15. Don’t be afraid to actively seek out and provide constructive criticism.
  16. Have the courage to think differently and discuss your inner thoughts with others.
  17. Committed to excellence in everything that we do and a clear understanding that the only way we can get there is as a team.
  18. Always try to put a positive spin on things.
  19. Do what we say we are going to do.
  20. Be humble.
Teamwork without email
  1. About to write an email. Write a task comment instead.
  2. Need to ask a question or get an updated file. Create a task.
  3. Have a team announcement. Publish on a blog or Wiki.
You are the business
  1. You are run your own business and just like any business owner you want your business to succeed. Share your thoughts on how you believe the business might succeed.
  2. Fix the problems even if they are not yours.
  3. Don’t complain, suggest solutions.
  4. Treat “failures” as opportunities for growth.
  5. Understanding the bigger picture of the business even if it is not directly related to the work we do.
When we miss a deadline we ask questions
  1. We underestimated the time it would take. Why? We didn’t have the right tools. Why? By the time you get to your fifth why you get the root of the problem. Then you can better avoid the same issue in the future.

RESTFul Webapi Implementation Guidelines

REST-WebApi Implementation Guidelines

 

Introduction

As we are going into the era where all devices needs to be connected with the server there is a need to build an API that is easy to use and all devices speaks the same langugage.

What is REST?

Representational State Transfer. It relies on a stateless, client-server, cacheable communications protocol — and in virtually all cases, the HTTP protocol is used.

What is Hypermedia?

In layman term, when the REST response comes back then it should include some webapi resources as a reference for the client. This way the client can get to know some valid URI that can be called by the client.

  • Method of self-describing messages
  • Hypermedia as The Engine of Application State == HATEOAS
  • Hypermedia can create dynamic, self-documenting APIs
  • But you can be a great API without HATEOAS

rest

Web Services Vs REST

The concept of API is in development industry since COM, however, what has been changed now is how easy this API is available for different devices.

COM       Limitation: COM should be packaged along with the program. COM is accessible for only specific programming langugage, which means C++ dll is not directly accessible to Java.
 DCOM   Limitation: A proxy needs to be installed on local machine. Again a compatiblity issue, permission headache.
ASMX    Web service that is accessible through HTTP protocal and the client only needs to know how to call through a proxy that uses SOAP as a message protocol.
SVC Client still needs to have a knowledge to interpret SOAP.

Why Web service era is drying… Web service calls require a standard to be followed such as SOAP. Not all devices knows about these standards. This adds a complexity to provide a library at client level that can communicate in SOAP message format and web service can be connected. In case of REST WebApi it uses http. Thus, it has less overhead as compare to previous technology. Now what it means to your coding that your functions are available as is from Mobile to a Desktop. All you need is HTTP to call, which is available even in 20 $ mobile phones.

Should you use REST?
  • REST or REST-ful APIs are easy to consume and maintain
  • If your API does not fit the Resource Model, RPC or custom APIs are fine
  • Your new development should starts from REST principle and if does not fit then please proceed with the old procedure.

What will you learn here?

Idea behind this article  is to give you guidelines on what should be done for making a a good Web API. This document is listing some points that I have learnt and implemented (some :-)) for WebApi architecture. You can implement these rule in any programming language. Let us understand these rules.

Rules

1. » Don’t use verb as a part of the URL. So rather than saying that /todos/update it should be URL: /todos METHOD: POST or PUT.

The main reason of not using verb is because as the project extend there are too many URI and it is hard to main these URI. Thus, it makes it difficult to manage your API.

1.1» Use Identifiers to locate individual items in URIs. It does not have to be internal key.

e.g. (internal key)
http://api.yourcompany.com/customers/23

or (non internal key - however unique identifier to determine that single entity)

http://api.yourcompany.com/customers/283473-asdf923-asdf2

1.2» Use either Plural or Singular noun. However, don’t mix it.

Preferred Preferred Not Preferred
/polls/23 /poll/23 /polls/23
 /todos/2384  /todo/2384  /todo/2384

2. » Concrete is Good over Abstract; so instead of saying /items/23 it should says the type of items like /cars/23

3.» Don’t use query string (?) in the URL, where possible; Set Association resources/id/resources through url.

http://...api/Customers/1/orders
http://...api/customers/1/payments

4.» Use pre defined HTTP status code in your returned header of Api methods. refer available HTTP code at http://en.wikipedia.org/wiki/Http_error_codes

5.» You should also give an option to supress the code by giving an optional parameter which will force API to always return 200. suppress_response_codes. /customers/1? suppress_response_codes=true 

Response should be:

HTTP status code: 200 {"error":"Could not authenticate you."}

6.»  Make the version mandatory. Specify the version with a ‘v’ prefix. But keep in mind that API version is not product version. There are 4 types to implement Versioning:

  • Version as a part of URL – The main drawback is maintaining client on url change.If you are defining URL based version then move it all the way to the left in the URL so that it has the highest scope (e.g. /v1/customers).
  • Version as a part of Querystring – Same drawback as above.
  • Version as Content Type in Accept Header – The main drawback of this approach is it adds complexity implementing custom header on all platform. It can also encourage increased versioning which cause more code churning.e.g. Accept : vnd.api.v1.customer
  • Version as Custom Header – Same drawback as Content Type.e.g. x-api-version: 2 or  x-api-version: 10-07-2014

Whichever way you go, use a simple ordinal number; Don’t use the dot notation like v1.2; Before obsoleting previous versions give developers at least one cycle to react.

7.» Implement partial response; Partial response allows you to give developers just the information they need.

  • Implement Partial GET
  • Implement Partial Patch

8. » Make it easy for developers to paginate objects in a database; Use limit and offset to make it easy for developers to paginate objects.

9.» Accept different format and content negotiation is a Best practice. Use Accept header to determine which formats are allowed.

GET api/customers/1 HTTP/1.1
Accept: application/json, text/xml
Host: localhost...

10. »  Use JSON as a default return type, following Javascript camelCasing conventions for naming attributes.

e.g. {"firstName":"Joe","lastName":"Public"}

11.» Standard place to host is api.xxx.com and if the request is coming from the browser, then redirect it to developers.xxx.com. Also, redirect any request coming for dev, developer to developers.xxx.com

12.» On successful update, return 200 (or 204 if not returning any content in the body) from a PUT. If using PUT for create, return HTTP status 201 on successful creation.

13.» It is strongly recommended to use POST for non-idempotent requests. POST is neither safe or idempotent. It is therefore recommended for non-idempotent resource requests.

14.» PUT vs POST for Creation In short, favor using POST for resource creation. Otherwise, use PUT when the client is in charge of deciding which URI (via it’s resource name or ID) the new resource will have: if the client knows what the resulting URI (or resource ID) will be, use PUT at that URI. Otherwise, use POST when the server or service is in charge of deciding the URI for the newly-created resource. In other words, when the client doesn’t (or shouldn’t) know what the resulting URI will be before creation, use POST to create the new resource.

15.» Choose CORS whenever and wherever possible.

16.» Non-Resource API

  • Be sure that the user can tell it is a different type of operation
  • Be pragmatic and make sure that these parts of your API are documented
  • Don’t use them as an execute to build a RPC API
e.g.
http://...api/calcualateTax?state=GA&total=149.99
http://...api/restartServer?

17.» It is recommended to return an Entity Tag (ETag) header for each GET (read) operation. It should support Week Tag, starts with W/ and supports Strong Tag. if-None-Match header key is used for specifying the ETag value.

GET: /api/customers/1 HTTP /1.1
Accept: application/json, text/xml
Host: localhost
If-None-Match: 823748374783

Request response should return 304 status code.

18.» Protect your Api

  • SSL is almost always appropriate.
  • Secure the API itself using:
    • Cross Origin Security:
    1. JSON with Padding (JSON)  – not recommended coz the callback has to be maintained.
    2. Cross Domain Resource Sharing (CORS) –

19.» Authorization & Authentication 1. Authorization – Use API Keys 2. Authentication  – Options:

    • Website security such as Form, Windows Auth, 1st Party Developer (internal auth.)
    • Use OAuth 3rd party Developer (external auth.)

In the next series of post, I will explain & implement these rules with the help of .NET WEB API programming language.    stay tuned…. Connect with me: View Amit Malhotra's profile on LinkedIn.

Should we go with Delegate or Interface?

Delegate and Interface can provide you a a great mechanism that will separate the definition from the declaration.
Before we go into the detail about when to use what, let us first understand what is delegate (C/C++ pointers) and what is interface.

What is Delegate?

A delegate is a pointer variable declared as a variable of custom build type that can stores the reference to a function. The type should define method’s return type and its parameter types.

The following define a delegate type called StreamWriter

delegate bool StreamWriter (string text);

Here’s a complete example:

delegate void StreamWriter (string text);

class Test {
static void Main() {
StreamWriter t = ConsoleWriter;
t("Print this");
}

public void ConsoleWriter(string value) {
Console.WriteLine(value);
}
}

What is Interface?

An interface defines a template for its implementors. Just like an construction architect gives a blue print look through model, a software architect can use Interface as a tool for a blue print look for classes.

Should we go for Delegate or Interface?

  • Use a delegate in the following circumstances:
  • An eventing design pattern is used; that is multicast capability is needed.
  • It is desirable to encapsulate a static method.
  • The caller has no need to access other properties, methods, or interfaces on the object implementing the method i.e. The interface defines only a single method.
  • Easy composition is desired.
  • A class may need more than one implementation of the method; The subscriber needs to implement the interface multiple times.

Use an interface in the following circumstances:

  • There is a group of related methods that may be called.
  • A class only needs one implementation of the method.
  • The class using the interface will want to cast that interface to other interface or class types.
  • The method being implemented is linked to the type or identity of the class: for example, comparison methods.

In conclusion, it all comes down to your architecture. If your architecture needs event looks like callback operations. Then delegate wins over Interface. But if you want to define few methods along with some properties to be available through template then interface is your best choice.

How can I easily tell what caused the error – DbEntityValidationException ?

I came across with the situation where I have used Entity Framework 6.0. While calling SaveChanges on my DbContext, I get the following exception:

System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.

 

After going into the exception detail all I could get to know that there is an exception at SaveChanges() method. So this is what I have done:

System.Data.Entity.Validation.DbEntityValidationException was unhandled
 HResult=-2146232032
 Message=Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.
 Source=EntityFramework
 StackTrace:
 at System.Data.Entity.Internal.InternalContext.SaveChanges()
 at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
 at System.Data.Entity.DbContext.SaveChanges()
 at ConsoleApplication1.Program.Main() in c:UsersamitmSkyDrivecodeConsoleApplication1ConsoleApplication1Program.cs:line 19
 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
 at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
 at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
 at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
 at System.Threading.ThreadHelper.ThreadStart()
 InnerException:

No where it is telling me about why it has actually occured.

 

Solution:

To solve this problem what I did is I override SaveChanges method, catch the exception of type DbEntityValidationException then get an entire exception through Linq:

public partial class BookContainer : DbContext
 {
 public BookContainer()
 : base("name=BookContainer")
 {
 }
public override int SaveChanges()
 {
 try
 {
 return base.SaveChanges();
 }
 catch (DbEntityValidationException ex)
 {
 // Retrieve the error messages as a list of strings.
 var errorMessages = ex.EntityValidationErrors
 .SelectMany(x => x.ValidationErrors)
 .Select(x => x.ErrorMessage);
 var fullErrorMessage = string.Join("; ", errorMessages);
 var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);
// Throw a new DbEntityValidationException with the improved exception message.
 throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
 }
 }

 

Now when I get the exception result, I get it with “Column name” that has caused this trouble.


System.Data.Entity.Validation.DbEntityValidationException was unhandled
 HResult=-2146232032
 Message=Validation failed for one or more entities.
See 'EntityValidationErrors' property for more details.
The validation errors are: The WebSite field is required.;
The WebSite field is required.;
The WebSite field is required.; The WebSite field is required.
 Source=ConsoleApplication1
 StackTrace:
 at ConsoleApplication1.BookContainer.SaveChanges() in c:UsersamitmSkyDrivecodeConsoleApplication1ConsoleApplication1Book.Context.cs:line 45
 at ConsoleApplication1.Program.Main() in c:UsersamitmSkyDrivecodeConsoleApplication1ConsoleApplication1Program.cs:line 19
 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
 at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
 at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
 at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
 at System.Threading.ThreadHelper.ThreadStart()
 InnerException:

ELMAH Vs. Log4Net

  ELMAH Log4Net
  Can go complex if you don’t know what are you after Easier to use as compare to Elmah.
  ELMAH will help you to catch any unhandled exception and store them in order to be checked. Log4Net will do what you will ask it to do. Hence you will have to write the code.
  ELMAH can only be used with Web based application. Log4Net can be used with any windows form/ console application. It can also be used with web based application.
  A very good solution for “Screen of Death”: It can just log.
  It can only be used for exception messages I can be used for any kind of logging.
 

 

Practically speaking, we need both.

And that is why it will be great if we can something in between who can pass out the message from one to another.

 

The ELMAH-Appender is what it does. It communicate with the ELMAH library on behalf of Log4Net. So we can use Log4Net like LogManager.GetLogger(typeof(MvcApplication)).Info(“<message>”).

 

For more details please refer: https://nuget.org/packages/elmahappender_log4net/

Why you should use Apple TV for your next presentation?

Why you should use Apple TV for your next presentation?

 

Is it not great that I can just use my mobile phone to start the presentation and do everything without any wire?

Well, here I have just bought the product called “Apple Tv”; it is just fantastic that I can connect any IPAD, IPHONE (where the device has got the presentation/ document). The main benefit I find is that I don’t need to know how to operate other’s device or find the way to transfer the document to present.

Why you should use Apple TV?

  • Handcuffing Wiring someone to a projector or TV is the pits
  • There are cable compatibility issues
  • It takes time and is inconvenient
  • If you’re still using VGA or less, the quality is awful
  • Tablets can’t be connected without even more adapters
  • Audio remains at the device
  • Changing presenters is another fiasco

While you can still go wireless using a projector, here is why you should go with TV over projector:

  • Good projectors are more expensive than good TV’s today
  • Projectors commonly have resolution restrictions (think huge icons,small workspace)
  • Projectors have long warmup times, leveling, and focusing issues
  • Projectors are very sensitive to lighting conditions
  • Projection screens are a pain, using a wall is not ideal

 

I must say that the IPAD + Apple TV + iCloud is the perfect combination for your presentation anywhere.

Pro SQL Database for Windows Azure

 

Notes:

 

  • Direction. The direction of data movement. Egress shows outbound data, and Ingress shows inbound data.
  • if your application needs to store more than 150GB of data, or if your database can benefit from a multithreaded data access layer, you need to consider splitting your data across multiple databases through a form of partitioning called a shard.

Programming with SQL Database

  • On Premises Application means your application is hosted locally and not in Windows Azure, but your database is in a SQL Database instance. This option comes with the limit that you can use .Net Framework 3.1 or above … System.Data.SqlClient or later.
    Entity Framework 3.5 sp1 or later
    SQL Server 2008 R2 Native Client ODBC driver or later
  • If the application uses OLE DB, then you have to change it to use one of the client  libraries listed above.
  • Azure-Hosted Application provides benefit with minimizing network latency of requests to the SQL database instance.  As long as your Windows Azure and SQL Database are in the same subregion, bandwidth usage
    between SQL Database and Windows Azure is free.
  • You must consider many things, including the following:
    • SQL Database is only available via TCP port 1433.
    • SQL Database doesn’t currently support OLE DB.
    • SQL Database only supports SQL Server authentication. Windows Authentication isn’t
    supported.
    • When connecting to SQL Database, you must specify the target database in the connection
    string. Otherwise, you’re connecting to the master database.
    • Distributed transactions (transactions that affect multiple resources, such as tables, or
    different databases via sharding) aren’t supported in SQL Database.
    • You must ensure that your SQL Database firewall is configured to accept connections.
    • You must determine whether an • y embedded (in-line) T-SQL in your application is supported
    by SQL Database.
    • You must use the login name format <login>@<server> when connecting to SQL Database,
    because some tools implement Tabular Data Stream (TDS) differently.
  • SQL Database tables without a clustered index aren’t supported.

 

 

SQL Data Sync

 

SQL Data Sync provides bidirectional synchronization between two or more databases. On the surface, it is as simple as that; but even behind the scenes, it does not get much more complicated.

 

 

Solutions for Team Conflict

By Renee Evenson.

Reference: ToastMaster – Sept 2012

When you arm yourself with the skills to meet conflict head on and work quickly and effectively to resolve problems, you will gain respect as an involved leader who is committed to being part of the solution rather than part of the problem.

 

View every conflict as an opportunity.

Conflict is a natural component in all relationships and should be welcomed. “Without resolution, resentments stay below the surface and magnify. When conflict resolution allows for good discussion, those involved can begin to move ahead.”

Anticipate problems and deal with them immediately.

Become an active observer and communicator; stay involved and watch for things that are not right. Be aware of coworkers who suddenly become negative, quiet, agitated or upset as this is often a sign of conflict.

Communication is key to resolving conflict.

Miscommunication is often at the root of arguments, so it makes sense that good communication is the key to resolving them. Resolving conflict effectively is as simple as 1-2-3:

1. Listen and Question;

2. Decide and Plan

3. Respond and Resolve.

Always remain calm and in control.

Suggestion is to back up, take a deep breath and consider your response. Learning not to be reactive will help slow y our racing heart and racing thoughts.
Continue reading “Solutions for Team Conflict”

Results without Authority

  • Even though leaders have got the authority, ordering people to do something is unlikely to result in them really wanting to do it.Using command-and-control authority to force people to do things that they don’t want to do results in resentment and demotivation.Malicious compliance is also a risk; people may find ways to appear to cooperate while actually harming the project.If generals and admirals cannot always expect automatic obedience, what chance does a project leader have?
  • “WII FM” – What’s in it for me? Leaders in any field invest the time to understand what the peole they are working with really care about. Effective project leaders identify opportunities to align what the project needs with what the individuals want to do, and they assign responsibility for project activities accordingly.
  • Only one project charter should be maintained. Any new request that is conflicting with will be denied.
  • Motivation has got six areas: achievement, recognition, the work itself, responsibilities, advancement and growth.
  • Influence ProcessDocument your objective > Identify who could do the work  >Evaluate your options and select the best person > Consider the other person’s perspective > Possibilities for exchange  > Meet with the other person > Verify your assumptions and determine what to exchange > Request a commitment > Document the agreement > Deliver on your offer and track the work to completion.

Agile Contracts

Every Project Manager is not  interested in – Agile Contracts. They feel constraint!

No one like to talk about Contract because of the Agile Core Value say : “Customer Collaboration” over “Contract Negotiation”.

Generally speaking the  process of generating the contract is as : Collaboration -> Commitment -> Accountability -> Contract

 

How it all started : Here is my Business Requirement. How much it will cost and when it will be done?

We know that it is going to be wrong no matter what we put in. Then how we will derive a business proposal?

One is through the Flipping the iron triangle. Normally we go through the scope  – to schedule and cost calculation. However, many time we commonly focus on schedule and the cost.

The successful project  could be driving a scope from schedule & cost.

 

With value-driven based on the schedule and cost one can deliver the valuable items for the Business.

 

Draw Proper Distinctions:

Proposal that transit to Project by having a contract.

Proposal is not same as Project.

Costing System:

 

The old model works with: If you win, I must loose. If I win, you must loose.

Fixed Contract – The model it works with that both win, both loose concept.

 

 

Another way is that to deliver the valuable items in iteration. Offer to cancel the project after some specific % of valuable items have been delivered. In this early cancellation clause customer has been asked to pay for the items that have been delivered + 20% cancelation fee on the remaining 15%.

 

Through this way you have saved customer money and you have been paid 20% without doing anything.

 

Examples are as below:

NOTE: Although profit is much better. However, some management may prefer revenue than profit. However, its a management level issue.

Another technique is Fixed Price work packages or in Agile form called Fixed Price Stories

Idea is to decompose into smaller packages; that is what agile practitioner should do.  Through this way I have reduced the risk. You start with the first delivery and then with the option to change the requirement along the way. Then you can re-estimate.

Through this way you are sharing a risk.

As a agile project manager you are not supposed to put everything in the contract.

 

Contract should cover More Stable, Moderate Change, and More Changing component

Under Master contracting Agreement – you can put penalty as it is not changing quite often.

Don’t have a single document contract. Create based on something stable, something changeable.

You cannot think of putting everything in the Contract. That is what legal would want to. But this is not a recipe of collaboration. However, PM should not be signing a contract.