This Weeks Focus
Hey everyone! Hopefully you are enjoying following along with my progress to this point. Over the last two posts, my focus has mainly been on starting slowly and keeping things simple. While some of that will carry over into this week, some changes are coming!
This week I am trying to introduce some organization to the project as a whole and start to actually bring some of the fundamental concepts of the application into being. This fundamental concepts include things like:
- Introducing models
- Starting to build the core APIs
- Creating some reusable utilities
This is the point where the application starts to look a little more realistic.
Feel free to check out all the changes I’ve been making and don’t forget…
You are also allowed, welcome, and encouraged to provide feedback!
You can either send your feedback directly via email (firstname.lastname@example.org) or by using the Contact form.
I look forward to hearing from you!
And make sure you subscribe to the Lawn Journal Project to get all the behind the scenes updates!
This is where I begin to add the concept of a Lawn to the application. I do this via what I would call a Model. Generally speaking, in software development, a Model is simply a class that represents a concept within your application and typically “models” something in the real world. In this case, I created 2 model classes to represent the following:
- A Lawn
- An Address
As you can see, right now, an Address is a sub-model that gets associated with a Lawn.
In the previous commit, I made another small mistake. I was most of the application source code to be under the “app” directory. When I created the “models” folder to hold all of my model classes, I accidentally created it under the root folder. So I moved it under the “app” folder. 🙂
This is currently my largest commit to date. Since I now have some nice model classes, it would be nice to start using them in my APIs. So I built out some basic functionality in the Lawn and LawnList APIs to handle the basic CRUD operations in both places.
In addition to using the models in the APIs, I did a little refactoring and moved the API classes under a “resources” folder, created some test data to play with in the APIs, and created a utility function to convert a dictionary into an instance of the Lawn model class.
Lot’s of work went into this commit, as well as lots of Google searching for how to do certain things in Python and Flask. But that’s the way it goes!
With most of the effort to this point being backend, I needed to switch things up a bit. I decided to use the Create React App tooling to create everything I needed to get React up and running quickly in my app. From there I just updated the boilerplate code to display a simple welcome message.
Based on a lot of the sample code I’ve been reading, it seems fairly common to have the main entry point Python file (run.py) out at the root of the Python application. So I took this time to move my “api.py” file out of the “app” directory to the root and rename it “run.py”. I also needed to change the import statements through my code to reflect this change.
This commit is the start of working with the React front end of the Lawn Journal application. In this commit, I created my first React component that is a sample of how to create a custom component and have it render some static data.
I’m not very concerned with the UI of this application right now. I want to spend most of my time working with the functionality and make sure that the Minimum Viable Product (MVP) can perform the operations that I want it to. Having said that, it’s not very enjoyable to look at a completely vanilla UI for any application. That being the case, I decided to at least add Bootstrap to this application so it doesn’t look so “unfinished”.
This is pretty exciting! I changed my LawnList Component to actually call my Python Flask API on the backend to retrieve the sample data list of Lawns and then render that list on the page! This is a huge milestone!
This commit completes my basic thought process of wanting to get the “basics” installed and up and running. In this commit, I added the Flask-PyMongo library that I think I will be using to interact with MongoDB from my Python Flask Api. Of course, anything is possible and I could change my mind later, but this will be the library I will be using to get started working with MongoDB.
What’s Coming Next
This week was very productive. I worked at least an hour every day to get things setup and “working” in the simplest terms. I have all the basic tools and libraries installed. In the next week, I’m going to shift the way that I am thinking to start to look at this app at a slightly higher level and start to design “features” of the application from the API perspective.
I don’t feel that I am quite to the point where I am going to try to shift to “user stories”, but I am getting close. So in the next week or so, be on the lookout for changes that will involve getting my base Apis up and running to perform basic CRUD operations all the way from the Api down to MongoDB. Should be exciting!
Stay tuned for more changes!
Remember to subscribe to all the behind the scenes access to what is going on!