Blog

  • Experience with React

    I’ve spent the past few months learning React. I see it’s usefulness but in all honesty I’m not really a fan of how it works. If I were to be in the business of building large projects with millions of users and dozens of functions, sure I could see it being great. But that’s not what most of us do. We design small little apps that we can perform and handful of actions with.

    If your intention is to become a front end developer I think there are better tools that React. But that’s a different topic all together.

    The project I decided to create to show my abilities with React backfired on me big time. I attempted to make something that would be as simple as possible while still fulfilling the requirements. I decided to create a Fantasy die roller, to emulate polyhedral dice for role playing games. I designed it originally with 4 components; a roller, a result pane, a saved die pane and finally a dice tray to keep all the components and props in.

    The roller was to take in user input on what kind of die was to be rolled and allow the user to name and save the roll if desired. When the roll is saved, it should check the name against the saved rolls and if the name doesn’t exist go ahead and POST to the API, ‘saving’ the die. If the name does exist, PATCH the id number attached to that name instead to update it.

    The Saved die components job was to allow for the display of any rolls the user decided to save. It would have a list of these rolls and the option to either re-roll the same die or delete it from the list.

    The results component was simply to display the results to the screen.

    The Dice Tray component was to hold all the logic for handlers and rolling the actual dice.

    After a white boarding session to plan it all out I got to work creating the frame of the site. I created all the components and hardcoded a render of their name to see where it would sit on the page. Then I began some basic CSS to align everything and put the components where they needed to be in relation to each other. During this process I decided to eliminate the Dice tray component all together. This project was small and rendering everything to the tray and then the tray to the App and then the App to Index.js seemed like unnecessary steps. I removed it and shifted all the functionality to the App component.

    I began by getting the function for the actual dice together. That was simple enough. Then I had to pass props to the Result component to be displayed on screen for the user. Again, pretty straight forward. Next I worked out how the saved rolls could be handled, so I designed 4 handle functions, save, delete, update and roll handler. The first 3 making API calls to store and retrieve dice, the latter invoking the die roller. I added an additional function on the Saved dice component for Re rolling that grabbed the parameters for a saved roll in the API and passed them through the die roller function to recreate rolls. All of this took me about 10 hours.

    The place I went wrong was in displaying the Saved rolls in the component. I invoked a side effect to call the API and map through all the results in the saved rolls component, placing them on the screen. It works for all cases, saving, deleting and updating. The issue I found is that it does not “react” the same way my results component does. That one changes everything based on the state of the result changes, the effect does not.

    I spent another 20 hours over two weeks trying to fix it but could not get it ‘react’ when a state is changed. I’m at the point where I think useEffect was not the proper way to get the results I wanted in the first place. I attempted to pass several props as control parameters in useEffect but never got anything other than an infinite loop. The only way to avoid that is using [] as the argument.

    In addition to that, I had another student spend at least 10 hours on trying to help me solve it. After several hours of both of us banging our collective head against the wall. It was time to give up. Since I already have 1 “reactive” component in the results pane, I opted to code around the problem and at the last minute created a callback function that gets invoked with the handler functions, this refreshes the page after the API call completes. Same result even though it totally misses the point or React.

    Other than having to refresh the page to see the updates, it works fairly well and I hope to not only fix the bugs I still have but I’d like to add some additional functionality going forward.

    Stretch goals:

    • Have the results list continue to log previous rolls with the newest on top
    • Add the ability to roll multiple dice at once i.e.. 2d6
    https://www.youtube.com/watch?v=bWqz8MaZjcc
  • APIs are rough

    I decided to create a website to help gardeners make planting decisions like when and what to plant. The plan was to use a weather API to give a forecast and the USDA API to give information on the plants the work in the region the user is in. I wasn’t able to complete it in the end due to some technical issues.

    When I began learning how to access APIs I knew it would be a bit tricky. It wound up being harder than I thought. I ran into some problems with formatting the fetch statements and after several grueling hours found out the API docs were wrong and the endpoint I needed was different.
    Once that was all figured out it was a matter of handling the data coming in, which caused another problem. I needed to grab the return and pass it to another endpoint and the second endpoint seemed to fail as well. In the end the second endpoint has been throwing a status 200, returning the correct url which shows the data but still won’t allow the data to show up where needed. An odd problem that several people including an instructor couldn’t understand. The fix is still out for investigation.

    The rest of the project it was attached to went fairly smooth. I Have a history with HTML and CSS so after a time it all came back to me and I was able to make a nice simple site with a clean look. I used an event listener attached to a checkbox to build my own version of a dark mode feature. When checked it removes background images and reverses all the styles on the page for color. When unchecked it puts back all the original styles and brings back the background image. At the end I decided to add a quick button that opens a mailto link me as a suggestion box.

    This project overall challenged my abilities and made me sharpen my rusty skills. This taught me that I need to go ahead and review a few basics that a struggled with while working on this. I look forward to continuing to build my skills.

  • Dear IT people: no one values you

    Dear IT people: no one values you

    I decided later in life that working retail – sucked. I felt undervalued and disposable. The way you get treated in most retail jobs whether a hardware store or a restaurant basically follows the same formula: you are worthless and replaceable.

    The management is always looking to cut costs and the one universal truth in any business is that payroll is controllable. Every company will pay you the least amount of money they can get away with. Your raises will always be percentage based, which takes your original lowball offer and amplifies it’s effect over your whole career. Once you take the job, you will always be underpaid. To earn more money you can jump ship and take a new job but the fact that you are paid so little means you are willing to accept another lowball offer simply because it’s still more than you already made, even if just a bit higher. You are trapped for life never earning what you should.

    So I went back to school to try to improve my lot in life. I took the loans and dedicated the time and after 4 years walked away with that bit of paper that said I’m employable. I went on to turn an internship into a job into another until I wound up where I am today. I’m an IT Engineer. Sounds impressive right? You would think, since I had to get a 4 year degree, 2 certifications and 6 years of experience to land the job but alas I made a mistake. You see I’m not an IT Engineer but rather an IT SUPPORT Engineer, and that my friend is the difference. You see it doesn’t matter how skilled, experienced or knowledgeable I became. It doesn’t matter I’m a Cisco Network Engineer. It doesn’t matter I was an Assistant Director of IT for several years. All that matters is the word support. I’m here to serve others.

    Even as an educated, experienced and skilled Engineer, I still get treated like a waiter. I’m still paid hourly. The difference is I also have to do the work of Systems Engineers, Network Engineers, Security specialists and any other task WHILE I’m serving customers with a smile. I still get asked to do more with less. I still got lowballed on entry. I will still be underpaid my whole career. Even after everything I did to get here at the end of the day I’m just a blue collar worker in a white collar building.

    /end rant

    So the question that was posed to me was “Why did you decide to study Software Engineering?”

    The answer is mostly based on the above. But there IS more to it than that. I went to school to become a Network Engineer. The problem with that was the schools don’t offer it. The secondary education system in this country is slow, much slower than technology for sure. So I did the only thing I could and got my B.S. in Computer Programming and Information Systems where I was able to specialize – almost like having a minor but not really – in Network design.

    I did well enough in the programming classes but never really enjoyed it. My focus and class choices were always based on networking. I learned the basics like C++, Java, SQL, and VB. When I left school I went the next few years not touching an IDE. Then I had a problem.

    I run a team that’s new. We are doing something that’s never been done before and had to create dozens of new processes to make it work. In doing so we wound up with a large number of workflows that had repeating manual steps. I decided there’s no reason this can’t be automated for us and began to rewrite my workflows in an almost pseudo-code like fashion using decision trees. It just happened that around that time another Engineer was working on something similar for another group in our division. We got together and created a set of scripts that took all my processes and packed them into java script buttons.

    This cut the time to do the job by more than half.

    From this I worked on several other projects where I was able to improve or reinvent things and the impact of these projects has been extraordinary. Anything I need to do more than a few times can be boiled down to a quick user script. I can make a huge impact on the company and suddenly am highly valued. I never wanted to be a programmer but I also never programmed something for ME, something that I could use in the real world and measure. This was a light bulb moment that changed my career.

    I learned that adding a new skill like programming to an environment devoid of that skill makes everyone think you are a wizard. Everything you do is magic to them. You suddenly are treated better, your value goes up and your career choices expand.

    You know how in the movies someone goes back in time with a BIC lighter and claims to be a GOD? The management teams are the primitives and scripts are my lighter.

    So basically I’m looking to master scripting to make my life easier and earn more money. With the added benefit of looking like a tech wizard to my bosses.