📜 ⬆️ ⬇️

Online store. "Divide and conquer" or "OO already here"

And why don't you, colleagues, join the online store?
Fearfully? That's the same, and I'm scared. And here we will talk about how to overcome your fears. With the help of ... an object-oriented approach.

At the end of this annual convention, he spoke to the assembled, with a wide imperative, magnificent wave of his hand pointing to a huge map of the United States that covered the entire wall.
behind him and said:
- Here it is, your market! Go and sell!
Thomas Wolfe, "No Return Home"


An acquaintance of mine, an Internet creator, very dexterously makes money on all sorts of descendants of the banner system. Sites, ads, citation ratings ... Once I asked him - why don't you make your own online store (hereinafter referred to as IM)? Like, incomes are several times higher. In response, he paused and said - it is difficult.

Blocks and interfaces
')
Yes. This is hard. But in my opinion there is a way to solve problems on the way to the development of online shopping. This is the classic "Divide and Conquer" - "Divide and Conquer", used, in particular, in object-oriented programming. We divide the circuit into weakly dependent blocks and connect them via interfaces. Interface implementers can later be changed at their discretion without affecting the process as a whole. So, look at the diagram below.

Use Case online store layout

Here we see blocks on one side of the barricades: Promoter, Warehouse, Seller, Courier. On the other side is the Client. And, with an attempt to neutral Switzerland, - Payment system.

What to do with these blocks?

First, get them to support certain interfaces. I called myself a warehouse — kindly implement support for the methods GetItemsList () and ReserveItem (). Yes, guys, yes. Time Excel-I passed, I have to put a server, buy software and pull vydelenku. Otherwise, they will buy from someone else.

By the way, for each block this interfacing is quite realizable by the forces of one person . Even I will take it personally.

We construct IM

Now let's try on one person the possibility of creating an IM.

So, a new future Internet merchant comes forward. Suppose that he has already bought a domain RussianVezares.com. Then he chooses the most suitable one from the list of vegetable stores. For example, at prices ( there is one small bonus here, but we'll talk about it in the next article ).

Let's go further. Will we promote ourselves? If not, then we are looking for a promoter, explain the scheme to him and send him a promotion.

So, the buyer came to us. He looked at the list of goods from the warehouse. And ordered a bag of stern turnips. At the same time, he filled out the delivery form. By the way, it was not even we who wrote it at all. We simply inserted the call form provided by the courier interface. Payment is made by the buyer through an external payment system. We booked a bag of turnips in the Warehouse and kicked the Courier through the same interfaces. The courier went, picked up the goods at the warehouse and delivered it to the buyer. Note : we will unravel the intricate buying processes in the following articles.

And the buyer all this time thought that he had a mega-company with his warehouse, courier service and other attributes. Naive.
findings

As we can see, each unit is fully realized by one person.

And what - no cons? Yes, as many as you want! Responsibility is divided, so cases of service temporarily unavailable will have to be entered into a contract with each interface vendor. And yes, the main drawback is that you still have to work :)

Source: https://habr.com/ru/post/13750/


All Articles