# Computer Algorithms: Multiplication

## Introduction

Perhaps right after the addition at school we’ve learned how to multiply two numbers. This algorithm isn’t as easy as addition, but besides that we’re so familiar with it and that we even don’t recognize it as an “algorithm”. We just know it by heart.

However, as I already said, multiplication is a bit more difficult than addition. This algorithm is interesting because for several reasons. First of all, let’s compare multiplication in binary and decimal.

So, let’s see how to multiply two numbers.

## Overview

Multiplying and adding is practically the same thing, so where’s the difference?

It’s clear that a product of two numbers (each with N digits) can be represented as N sums, as we can see on the next picture.

Now, for larger integers each time we shift left the next intermediate sum.

# MVC in Practice: Designing Models

## Existing Examples

There are lots of examples online teaching you what is MVC, why it is good and how to develop an application using this pattern. However most of them use a predefined structure with already constructed database and only the connection between a database table and a model is described. Actually what happens before all this. The client tells you something he’d like to have in his application.

Just imagine the following situation. You’ve a client who tells you that he wants a blog. The blog has to have posts and users, and every user must write posts and every post must have comments. Also he wants a set of categories where each post will be attached to one ore more categories. And finally a blogroll – one ore more links to another blogs.

This is pretty general and does not pretend to be a full featured example. However the strategy to make a primary structure of the future models is to pickup the nouns in this paragraph. It is really simple:

The blog has to have posts and users, and every user must write posts and every post must have comments. Also he wants a set of categories where each post will be attached to one or more categories. And finally a blogroll – one ore more links to another blogs.

So far you can see there are five prototypes of database tables: post, user, comment, category and link.

It’s important to note that not every noun is ready to be a database table. In some cases, when the client is really smart, he can give you a more detailed description. Than there are nouns describing the other nouns, of course, they are supposed to be columns to those tables.

Every post must have title and description

This is what we can do for now. From a raw text you can design your database and models in the MVC architecture.