Object Oriented Dreams
This is my first blog as a mentee in the ChiPy mentorship program. I am guessing that I am older than my mentor’s parents but it is great to be learning something new in a program such as this and being able to work with such a knowledgeable and generous mentor. You should never stop learning!
I have managed teams, developed, implemented, maintained and supported systems on mainframes, the cloud and done some development on pcs.
I have experience using COBOL, SQL, some dated proprietary languages developed by Cognos and a little PHP, HTML and CSS.
My family got involved with a charity raising funds to help find a cure for brain cancer. My brother was so committed to the cause that he felt we could be most effective if he started his own charitable foundation.
Since I was the only person in our close kinit group of family and friends with an IT background I became the chief cook and bottle washer for the organizations IT and communication needs.
The first thing we needed was software to handle our major fundraising event of the year which is a Run/Walk event. This event needed to be setup as a peer-to-peer fundraiser where you have individuals joining the event as fundraisers and then others can donate to the charity through the fundraiser. The fundraisers can also create and join a team if desired.
I had experience working with a couple of other charities that used the same fundraising software package and thought it would be convenient to use that software for our needs. After contacting that vendor and a number of others I realized that I did not want our charity to pay as much for the software (implementation fees, yearly license and % of funds raised), as the vendors were asking.
That was the point where I thought, hey I want to update my skills, we have a need for a new system, I have experience developing software, maybe I can develop it myself.
My Journey Begins
Since I had a bit of experience using SQL and a little using PHP I thought I could leverage it to build the software.
I started by installing WAMP (Windows, Apache, MySQL and PHP) on my laptop. I had a very good idea of the major features I needed, so I created the MySQL tables and was coding away with PHP in no time. I was surprised how quickly I could develop screens and soon had a few pages. However when I tried to do something a little more complex I would perform hundreds of Google searches and quickly found that I could not find a reliable source of information. Maybe it was my lack of knowledge or I was performing bad searches but after a while it felt that if my site was a house, I was building it by picking up driftwood as I walked along the beach and was stacking the driftwood up to make the walls of my house. I could build the walls but any unwanted creature could easily get into it and a strong wind would destroy it. I did not want to build such a flimsy house so I abandoned my development efforts and went back in search of a a vendor package. I soon found a vendor that offered much better pricing for peer-to-peer fundraising software.
However, I still thought I could save the charity a significant amount of money if I could find the proper tools. As I was researching various languages I became intrigued by Python and realized that it was a language I wanted to learn. After deciding to learn Python I discovered Django and realized that it was the language I could use to build my website.
On the Road
I started with Learning Python the Hard Way (LPTHW) and went through the first 30 or so examples. I then found the book Python Crash Course by Erik Matthes. That book went through some great Python code, some data visualizations and then had you build a simple blog site using Django. So armed with my newfound knowledge, I created my virtual environment, installed the necessary software and started coding using Visual Studio Code (VSC). I would clone what I could from the Crash Course book and was pleasantly surprised by the structure that Python/Django offered. Object oriented programming was still very new to me so I was assembling some screens but was not entirely sure of what I was doing. I got to a point where I wanted to display more than one record from the same model on the screen and searched for years(okay it was probably weeks or maybe 40–60 hours but it seemed like years) to find out how to do that. In my search I came across another book called Django Unleashed by Andrew Percival. While I couldn’t find the solution to displaying multiple records on a page in that book it did offer up a more in-depth explanation of Django than the Crash Course book. I was beginning to think that, hey I might soon know what I am doing. Well after searching some more I finally realized a modelformset_factory was what I needed to display multiple records. I added it to my view, tested it and got nothing. I would tweak the syntax a little, test again and nothing. At first I started with detailed tracking of what I was changing with the modelformset_factory so I wouldn’t duplicate a prior attempt. After 30 or 40 tweaks it seemed like I was just throwing random things into the code to test it and still got (surprise) no results. At that point I thought, well maybe I am not that sharp and I should just give up on my desire to create the charity app and master a new language. However, I persevered and after careful research I found a way to use the modelformset_factory to give me the desired results. In actuality, who am I kidding, I got lucky. There is an old saying that if you gave a hundred monkeys a hundred typewriters eventually they would type the entire works of Shakespeare. That was how I felt I resolved my issue.
It was about that time that I discovered the ChiPy group and quickly signed up for a MeetUp. The first one I went to was where some of the Spring 2017 mentees were giving their final presentations. An odd thing that happened was that there was an issue with the elevator so a number of ChiPy’s were in the lobby waiting to go upstairs for the start of the meeting. I was not big on networking but thought what the heck I might as well meet some people. The first 3 people I spoke to were from a company that was helping to sponsor the evening. When they asked me why I was there I told them I was there to see if I could find anyone to help me with some issues with an app I was developing for a brain cancer charity. As soon as I mentioned that, one of the gentlemen turned his head, pointed to a scar on his scalp and said, stage 4 glioblastoma. I almost fell over, that was exactly the thing that took the life of my 22 year old niece and the impetus for my brother to start the charity. I am not a big believer in fate but I took that as a sign that I was in the right place. The night was an enlightening experience, the presentations were very good, the group enthusiastic and seemed very supportive. I wanted to see if there was any way I could get into the mentor program to get help with my project and learn Python and Django.
As you can guess, I was delightfully surprised when I was selected for the fall mentorship program.
My mentor is a great guy named Peter. Peter works as a full time Django developer. He has been a great help in helping my get over new hurdles. I felt like I was going back down the rabbit hole when I wanted to use a ModelChoiceField. I struggled for a bit before asking for Peter’s help and he quickly solved my issue. He is setting me on my way to gain a better grasp on Python and Django and pointing out ways to improve my code such as explicit is better than implicit (for ex: if I am testing for an expected Get request use “request.method = ‘Get’” instead of the “request.method != ‘Post’” that I was using). Peter has also started the process of having me use Git and bitbucket the way an actual development team would use it. He has shown a lot of patience, providing answers to my novice questions.
Back on the Road
So I have several screens up and running and feel that I will make good progress with Peter’s help. My next few steps will be to create an additional search screen for team lookup, work with the admin screens for event entry/change, then clean up the menu. There will be a a number of other steps after that but that will be on a later blog.
Things I am learning
Things I need to learn
How to work with the Django Admin functions
How to call/use API for payment processor’s
How to create emails from Django
Things I would like to learn
How to properly set up tests for Django code
Class based views
At the end of the mentorship program I want to have a better grasp of Django so that I can more effectively use the Django docs to resolve problems or find a way to accomplish new tasks.
I also want to have the charity software to a point where I feel confident that I can complete it on my own and know that the software is secure enough that the charity will actually be able to use it to accept online donations.