Starting notes:
This tutorial aims at helping all learners of Python: businessmen, students, tinkerer and teachers learn web development with Python using Flask. One of the joys of Python is fun programming and web development seems to bring another level of happiness. This is dedicated once again to all Python learners! I've pulled in this tutorial from my own experience teaching Python and client requests. So be sure to roll up your sleeves as it'll be more than a toy app and requires some work as real world apps have more features. I'd be not so nice if in real life you get to develop something without a project statement. I'll also cover some secret techniques i found along my Python dev experience!
I'll deliberately in some places favour the stupidly simple over clever constructs, like copying some html instead of template logic. It would be sad if you don't understand something out of this whole writing, here's my mail for any question: arj.python at gmail dot com
Let's say you are approached to build a library management system to help your local book club. You got this message:
Hi, here are some details about the system we talked about:
We want to digitalise the whole process of book lending so that we
always have records at hand to search through.
We have 4 librarians and some 13,000 books. We have 400 members.
The loan period is normally 4 weeks. A note on book condition
is noted if there were some damages. The National Identity card is
used as library card id. Membership fee is $10 per month.
We'd like to be easily able to view overdued memberships. The fine for late
returns is $20 and in case of lost or damaged items, the fine is cost of
book + $5 processing fee. If a book is on loan, the lender should
be a able to reserve it.
Let's scan for entities:
You might think of what things were mentioned:
- librarian
- book
- members
- loan
- reservation
This gives us a good idea of what tables we should have in our database.
Things that remain constant are:
- membership fee: $10
- loan period: 4 weeks
- late return fine: $20
- damaged or lost fine: $20
- processing fee: $5
There is a hidden entity which is the admin. Besides librarian tasks, the admin can add librarians and modify the constants above.
Why invest in planning?
While i know that this tutorial is not directed to software engineers, planning and laying out your plans helps you track your project and get things built speedily. Let me tell you of a round-around planning technique that will give you as a non-technical person a grasp over the subject.
I found that if you draw all your pages and where the buttons will be placed with annotations of what they do, you get a clear picture of what you need to build. However, drawings much need lots of pages, few have special drawing tablets and you need a plan of what you need to draw. Combining the two into a flow-like diagram gives us multiple insights in one picture. The only downside if that the picture can get big. I call it Entity Centered Diagrams (ECD).
While there might be more changes, it gives us a nice idea of what to expect. The diagram above uses only squares and circles so that you can use your fav diagram editor. Me i'm using Dia Software available for Windows, Mac and Linux.
If you want more in depth drawings you can always go for the regulars like UML, ERD, Use Case etc but the above is aimed for people who would've coded without planning. And planning is better that direct coding.
Stay tuned for the next part!
Top comments (0)