DEV Community

Riz-waan
Riz-waan

Posted on

My Programming Mistake

﷽ (In the name of God the most merciful and compassionate I begin)

The following is not a project overview, rather a graduation speech style article taking you through one of my biggest programming mistakes.

The Story

Enter 9th Grade

I entered 9th grade with a little over 3 years of programming experience, mostly in scripting languages but with exposure in everything. Within the first quarter, my administrator/counselor introduced me to a problem: our school booking system. Without hesitation, my friend said we can make a better program. Enter, the mistake. I had no idea what I was doing, but I knew I needed to use a database, went through Google Sheets but ended up using MySQL and only one table.

Enter 10th Grade

I had to implement a new feature and while doing research I learned the MySQL is a relational database. This should have been my warning. But nope didn't listen continued to self learn MySQL only from problems I had. But this was fine as I was going to implement a lot of features that it was fine to restart from scratch.

Enter 11th Grade

I had a few more internships where I used my lack of understanding in MySQL, thankfully most of these projects didn't require a database.

12th Grade, the final blow

Deciding to allow the school to maintain the program, I first wanted to make it efficient. This is where I realized export takes 30 seconds, which shouldn't happen for only 200 rows. I decided to reach out to a mentor. And voila, he asked me a question: How many indexes did you use? Wow, my mind was blown, what I knew foreign keys were indexes, but I didn't set them as indexes. So I just made all of the important pieces as indexes. This lowered that 30-second operation to 0.2 seconds. Now, I would have just moved on, but my mentor told me there is a problem in my query as well. Guess what? You can use multiple joins without nesting them or using subselects, and that makes it much more efficient. Through this, thankfully I found out when you create a table you can reference a column to another column, so I started designing databases in MySQL Workbench. My problem was that I didn't know how to use the relationships feature in PHPMyAdmin but in designing an EDR it was much more in my face. At this point, I knew I had to restart, so that is where I am.

The Lesson

Learning through building is good, but do it using side projects, not a real project. And when self-learning don't learn only what you think you need because you may need a lot more. I learned that I need to start from basics instead of assuming I know things. Finally, I would like to say Congrats Graduates, and thank you DEV and GitHub for making this graduation possible!

Top comments (0)