How to handle checkout when we are selling unique products?

By   |

Checkout process for unique product has to be handled in different way than products which are available in quantities. Products with one quantity are unique product. Paintings, concert tickets, hotel rooms, flight tickets ( when you choose a specific seat) are unique products. Old household items are also unique items.

We have two types of process for processing any purchase. In first type, we can do cart based checkout where a user usually add more than one product to their cart. In the end of shopping process, user do checkout process for all products in his or her cart. In  second type of process, it is items based, user is forwarded to checkout process as soon as “Buy Now” button is pressed.

In this article, we will try to handle second situation as most of eCommerce websites which handles unique products handles checkout through that process only. We will discuss cart based process in another article in future.

First, let’s create list of challenges we have with unique products checkout.

1. As product is unique, we need to avoid over selling. Unique products have only ONE quantity. We cannot sell it to more than one user.
2. Payment stage in checkout process took some time as most of the time users will be redirected to a third party payment gateway.
3. Users leave the checkout process in middle.
4. A payment gateway does not reply in time or any other technical event may prevent us from getting payment processing information in time.
Before we go further, we need to identify the intensity of probability of duplicate orders. If you have really high demand for your unique products, then you have a big business opportunity. Instead of going into simple eCommerce checkout, you should introduce “Auction” model. This model works best for unique items like paintings for famous painters.


Lets assume 3 different situations. I will try to propose solution according to those situation.

1. Very high demand.
I will really recommend an “Auction” Model for this portal. You have customers and you SHOULD  monetize them for sake of your business.

2. Moderate demand
Mark product unavailable as soon as a user start checkout process. Set a timeout of specified minutes. Inform user about this time frame. We cannot tolerate slow users . Those will be handled in next situation.

3. Low Demand
Mark product unavailable as soon as a user start checkout process. Set a timeout of specified minutes. Refresh this timeout after every page refresh for user. By refreshing timeout with every request, we can handle very slow users. In my view, every eCommerce system at least cover this situation.

Now big question, How new users will be handled while an old user is in checkout process?

It depends on one very big factor, Are you using cache or indexer based search for your site? If you are not using any cache or indexer, you can simply make product unavailable.

In case of cache or indexer, we need adopt a different approach. I will  recommended leaving your cache or indexer system unchanged. Whenever a user tries to purchase an item, we need to put an extra check for checking “availability” of product for smooth transaction. If product is unavailable, we need to inform user.  WE may/can also show a waiting window to this user if timeframe is few minutes. In waiting window, A message like “We are checking availability of this product, this may take few minutes, Please stand by” can be shown. After specified time, if product is still available we can proceed with checkout or we can say sorry to that user and show other relevant products to him or her.


One thing more, do not forgot to record incidence of purchases where user did not finish payment process. You may contact them to know why they left process in the middle. This may be vital for your business.





In defense of QA team: Who is responsible for errors in any software or website?

By   |

Consider this hypothetical situation.

Something very precious was in a building. Building was being guarded by a guard who was responsible for the safety of precious item. A thief using his intelligence and luck stole that precious item from building. At a later stage, thief was caught but he claims that only security guard can be prosecuted for theft, in fact he demands that his act should be rewarded as a skill.

What is your first reaction? Impressed with thief’s arguments? Feeling angry with security guard? Or laughing on the irony? It can be anything, but I am going to ask a fundamental question, should we stop prosecuting thief for theft?

In my view, a thief is still a thief, no matter who was ultimate responsible person in this case.

Now, let’s apply this situational story on software development. An error ( I am not using the word ‘Bug’ intentionally) was found in software or website, who will be held responsible?

In my view, as far as responsibility is concerned, it lies with QA team, but development team is still responsible and can’t be absolve of that error.

Before we continue, lets me clarify my definition of error and bug in context of this article. A bug is an un-intentional behavior of application while an error is simply a failure of one feature. For example, broken login form is an error, but slowness of login system or successful login without correct details is a bug.

IN any software development process, basic testing of functionality has to be done by development team only. Even in our constitutional and parliamentarian laws, we have a term ‘merchantability’ … which gives an implied warranty in any purchase of product or service we bought from seller. So basic ‘merchantability’ has to be incorporated in any product or service. A pencil doesn’t need a documentation or purpose statement. Pencil is always expected to write on a paper.

Lets be more specific, suppose there are two buttons on a page, which supposed to do some specific task when user click on them. Those buttons don’t work and even cause a crash in application. Unfortunately, It went through to production.

Who is responsible? As I said, responsibility still lies with QA(Quality Assurance) team, but we cannot release development team from responsibility as they fail to test buttons for merchantability.

In my view, if we only held QA responsible for this situation, development team will be relaxed (… and lax) in their work as they know they do not own any responsibility in trials.

A thief is still a thief… A guard deserves his share of punishment and prosecution, but thieves still deserve to be punished, so they have some fear. Imagine a situation where thief will never be prosecuted because a security person has failed in securing valuables.

A clear line has to be created between errors and bugs, for any ‘error’ in merchantability, development team must be primary responsible party while bug falls under QA team

Your projects are not your real baby, you may need to dispose them

By   |

“This project is my baby, I don’t want to see it perform badly, I will give everything to protect it”, Does this sentence sound familiar to you? You may have heard it from your colleague or may have said it yourself.

In my view, ‘Like my baby’ is a metaphor which is over used and abused by many persons. What you will do when you found a really bad architecture based application whose programmers are just treating it like a baby? They love it, but afraid of losing it also.

Bad architecture happens, not just because someone was incompetent, bad things also happens due to things which were beyond control or unimaginable at the time of conceiving an idea or plan. But few people refused to understand that project may be like your baby, but they are not your real baby.

In real world, when we have a baby with different abilities, we try to help them to grow in different directions, we are supposed to support them in every sphere of life. We want to be with them, always; after all they are our babies.

Almost one year ago, I was discussing some serious flows in one of the application to his lead programmer who was also part of architecture and in fact was only “subject expert” available at time of idea conceiving and execution.
When I point out issues with architecture, he become little defensive and used the metaphor that a child cannot run from his first day. Things will improve with time. I tried to use the opportunity to tell him than if a child is born with bone disease, we cannot prepare him to run to fastest 100 meter run. He was really hurt with my statement. He was behaving like someone has pointed fingers at his own real child.

We need to understand that treating your projects like your real baby is a way to disaster. Projects got some specific objectives. If those objectives are not being met and current architecture does not support any way out, then we may need to discard them. So, we can start fresh. It may be difficult but only viable option for future use.

Love your projects, care for them, but understand that your projects have a purpose. … And this ‘purpose’ is the ultimate reason. Care for it.

Categories: Personal Tags:

2 things you should never do as a programmer

By   |

You will find lots of guides and articles on the internet about what you should do to be a good programmer. A lot has been written on what we should do to excel in any field.

In my view, its not only what we do which make us good in our profession. It mostly depends on what we should not do which make us excel at our work.

In this article I am making short list of two things which any programmer should not do.

1. Stop Reading about new things

If you think you know a lot about programming because you are an expert in one of the so called mother language, then you are making a big mistake. Even languages which were marked as stable and labelled as mother languages like c and c++ are changing a lot. At least new libraries and being added to them. So you should never stop reading about new things. Subscribe to few good magazines or journals, even if you do not have time to read all articles and magazines. You will be at least aware of what is going on around.

2. Coding before architecture

Never start coding before deciding on the architecture of your application. Its a huge mistake many new comers as well as so called experience people do. I can tell you from my experience in projects, its architecture which makes a project success or failure. Starting code before taking decisions and making plan for project execution is like going for ride when you really dont know where to go. Read about design patterns. They are documented solutions for common problems. Try to use them.

Categories: PHP Notes, Resources List Tags:

What are some limitations of PHP?

By   |

Recently I answered a question on quora. I am reproducing it here again.

In my view question is not complete and does not provide context which has to be evaluated to answer.

So I am writing this answer based on two assumptions.

First of all I am assuming that questioner is evaluating few programming languages and wants to make a decision which language to use or learn?

One of the major feature of PHP is also its biggest limitation. It is loose type and does automatic data type conversion in most of the situations. It does not force you to be good. You can easily write a bad code and it will not give you any warning or notice, but this does not mean that you can not write good code in PHP. So if you ever found a good PHP programmer, praise him/her because he/she is doing good programming without being under a hunter of strict compiler or interpreter.

PHP is more suitable for web development and shell scripts (yes it is quite good at command prompt also). You should not consider this for desktop applications. PHP-GTK is available but still far away from being productive. So one limitation is lack of desktop application development support. You can also not do mobile programming although you can run PHP on an Android device start [PHP for Android]

PHP supports almost all good features and data types but it does not force you to use them (.. and falls back to default behavior) which sometimes can be source of bug introduction in your applications.

As far as leaning is concerned, PHP is easy but I will suggest learning another strong typed language like C or Java along with PHP (at least basic knowledge must be there) if you really wants to go to a good level in programming.

Second assumptions, I am making that questioner wants to gather points to do fight with the PHP guy on the block, in that case I would suggest, Please do not waste your time, No language is without some shortcomings in some specific context.

So choose your language based on your need. PHP is best in some cases and worst in some cases

PHP is growing and is on a fast lane in new features introduction, so we can hope that it will extends its reach to more different verticals in near future.