Storing Data without a Database — Day 3 Bootcamp

“I ended up designing a database using python data structures. It was something new and I liked it”

source: pixabay.com

Day 3, last cohort

In this series of posts about my experience at Andela Bootcamp, I have finally reached halfway the race. It is day 3 and I can almost see the finishing line.

This time last cohort, I could barely look away from my laptop screen. I couldn’t afford to. Every second counted.

I had only covered about quarter-way of the assignments. However, that did not stop me from enjoying myself.

I loved the adrenaline rush when five O’clock was fast approaching.

Day 3, this Cohort

Enough of that. Let me tell you about this cohort. The Adrenalin rush is always there. It is lovely.

Today’s major task for me was to create a database without using a database! And no! That is not a typo.

In the previous cohort, I had played my reviewers using a technicality.

According to the assignment, I had to store data for my web application in a non-persistent way as “a database was not required”

I had gone ahead to use a database stored in memory! The instruction had been clear. “You don’t have to use a database but if you can, do so. Just make sure the data is non-persistent.”

It was easier for me because I ended up using similar code for two assignment, the one with the non-persistent data requirement and the other with the database-requirement.

Genius, right? All I had to do was to change the database connection string! Don’t look at me. It was all God’s idea!

This time, there was no chance for that. The instruction read “Use…no database”.

Creating a ‘Database’ using python data structures

Thus this morning, I set out to create the ‘database’ using objects, lists and the usual python data types.

I started with the design of the objects I needed to store. I only wrote empty functions with some comments lest I forget.

I then wrote a class ironically called ‘Database’ to …you got it…store my app’s data. Again, this was just a bunch of empty methods and some green lines of comments.

Then the testing started. I only managed to write tests for user account creation, login, and logout features. However seeing those pages flow smoothly put my mind at ease.

I had been scared of the confusion of the app context. Flask can be crazy, I tell you. I thank God it worked out just fine.

Day 4 is fast approaching. My plan had been to work on week 2’s challenges in week 1. It doesn’t seem like that plan will work out. What the heck, shoot for the stars, right?

If you want to check out my code on GitHub, go right ahead. The Heroku demo is also available. Check it out! Advise if you may and pray for me if you are a believer.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.