useReducing

March 13th, 2020
useReducer

One Week of Working

Well, I just wrapped up my first week as a Software Developer, and it has been an interesting one. It definitely didn't go as I had envisioned it; not in a bad way, just different than what I had expected. From what I've read and heard from others online, in most companies you spend the first few weeks getting accustomed to the codebase and learning from others on the team. While I did both of those things, I was also given a list of tasks to complete on my very first day. They threw me right into the fire. I'm fine with this, in a way, because I get to gain that much needed experience right off the bat. I know I document my journey through this blog on a daily basis, but I think it will be important to quantify exactly what I've done and will do in the future to add to my resumé or portfolio in some way, but I haven't figured out how. Right now, on my portfolio, I have 5 main pages besides the homepage: coursework, skills, projects, about me, and a contact page. I think it would be prudent to add a work experience page and document the projects I've worked on and the skills I've acquired along the way. In my first three days, I rebuilt the validation for a form in jQuery, a task that may have taken a couple hours for some, especially if they were familiar with the codebase, but for me took the better part of 3 days. I didn't really know jQuery, so I had to learn on the fly, and also learned a lot about DOM manipulation along the way.

jquery

Then, I was given the task of completing a page that would accept payments for quotes of their products directly. They have a version of this already, but you have to have built a quote before getting to the payment, and this would serve as a shortcut to this. I started working on this project on Wednesday, but really had no idea what I was supposed to be doing on it at that point, so I just got familiar with the codebase for this project. Actually, I took this React project and refactored it from being one 1600+ line file to being about 25 individual files on Wednesday. We had a meeting to discuss my role on this project on Thursday, and I got a much better understanding of what I would be building, but I was still struggling to understand how I would implement it. This is not a simple task, and I'm not in the position to be able to start building something right away without taking careful consideration of the codebase. I sat down later in the day with the guy who initially wrote the React project and asked him what he thought I should do. He suggested this might be a good time to take the project and move it over to TypeScript, and much to my pleasure, he allowed me to do the driving while he navigated the way. I learned the basics of TypeScript in a couple hours and we got all the way through the project. This was a great learning experience.

working-on-my-hooks

I still really hadn't started working on my task for the project, but I was starting to get a good idea of how I was going to do it. The first thing I needed to do was build a page that would check the representative's ID against the SQL database. I built this out, and then asked my neighbor to give me a hand with a part I was struggling with. He looked over the code, and suggested I use the hook "useReducer" instead of using "useState" like I was. I asked if he was sure he wanted to take me down that rabbit hole, and he pulled up a stool. We got to work creating the reducer and setting up the initial state for the reducer. It was really difficult at first and I was having a hard time grasping what he was trying to teach me, but then things started to click. When he left me to my own devices, I was able to expand on the work and add some error handling. I was also able to create a way for the user to confirm that the representative received from the database was correct, and either pass them through to the next step or take them back to the original of inputting the ID. I got stuck again, and asked for a hand, and he was more than willing to come over and give me a hand. Without him there, I would be completely lost, but he's teaching me a lot and I'll be more effective to the team because of the time he's spending now. My next move is to create a step in the process that allows them to choose the type of plan they are purchasing through a dropdown and some inputs. This will populate a price that will be held in the reducer function and will carry over the checkout step. The checkout, billing information, and confirmation steps are all built out already by the initial project, but there will be some tweaks made to this so it can accept the price without needing a quote ID, which it would normally need. There's still a lot to do, but the amount I've learned in one week is astounding, and I really wonder where I'll be in a month or two. It's going to be an interesting ride.

Until tomorrow!

Created by Sam Thoyre, © 2019