Tag Archives: Internet

MVC in Practice: Designing Models

Existing Examples

Sketch

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.

Mobile Internet Users are Getting More Important

Internet Mobile

It isn’t strange that the internet is becoming more and more mobile. When it matters to news sites I think most of the mobile versions are better than the “desktop” versions of the site. Take a look at Huffingtonpost.com or LeMonde.fr.

Mobile Ads

The first thing that makes impression when comparing both mobile and desktop versions of a site is the layout. Of course the lack of ads on the mobile version, or if not the absolute lack at least the small number of appearing ads, seems to be quite pleasant.

The thing is that as the web grow and as the web 2.0 is becoming a reality most of us will prefer to use it on a mobile device, just because it’s

  1. easier to use
  2. easier to find
  3. easier to follow

Here’s a nice example of what mobile phones are now.

Now lets take a look on how the mobile web will grow in the near future.

That graphics describe quite well what will happen in the upcoming years. Is there now a question: should I make a mobile version of my site?