The sample application
Before I start writing any code let me explain the app that we’ll build in this saga, some design considerations, etc.
We’ll build a simple classifieds website… Why?, simple:
- Because I know the domain well enough that I can come up with real-sounding scenarios of how to change/evolve the application (been working on classifieds sites since 2006, and have created at least 3 platforms for different geographies in that time)
- Because I’ve been there, so I can give a realistic view when thinking on how to implement it the MVC way
- Because I can and I don’t need to give any trade secret away to make my case. I mean, I’m building this thing in my spare time and I’m using no code from work that’s not available Opensource.
Classy: The simple classifieds app
In Classy we’ll implement the most basic aspects of a Classifieds Site:
- An Advertisement (Ad): What you post when you want to sell something, what you search when you want to buy something. it contains:
- Tags: Tags identifying the object or service for sale, its location, etc.
- A User: a person posting an ad on the site. A user has:
- Email (also the login of the user)
On the User:
- A user is automatically registered when she creates an Ad
- A user may request to be removed from the site to comply with the right to be forgotten
- If we see a user posting bad ads, we should be able to block her to prevent her from posting more ads
- Some users can act as administrators (admin). More rules on admin below.
On the Ad:
- An Ad needs a non-empty title and description.
- An Ad can be posted by a registered user. This user is the owner of the ad
- An Ad can only be posted by non-blocked users.
- An Ad can be edited by the owner and change both the title and description
- An Ad can be deleted by the owner
- An Ad has a duration of 30 days. After this period, if the Ad is still active, it’ll be automatically deleted
- Deleting an Ad removes it from the DB.
- An Admin can block, unblock or delete any user
- An Admin can delete any Ad
- An Admin can extend the life of an Ad for an additional 30 days at a time
- An Admin can only be set by changing its flag in the DB
On the UEX:
I’m no designer, so this won’t be pretty… it will be minimalistic. The following flows/pages will be needed:
- Post ad page: Single page
- Will validate the Ad content (not empty)
- If the user doesn’t exist it’ll be created
- Home Page / Search
- The home page is where you browse for ads
- Ads are shown in reverse chronological order (most recent first)
- If the user is identified in he frontend, she’s given options to edit or remove her ads
In the next article, I’ll discuss the design of Classy the MVC way