DEV Community

Cover image for Its okay to be dependent ...
J Signature
J Signature

Posted on

Its okay to be dependent ...

Recently I started to learn about Ruby, Active Record, Sqlite3 and Sinatra. Together they made up a framework for one of the many possible ways of building a functional back end to a web application. Most of my time up to this point has been working with front end tools like React. In a world where the mindset to be as independent as possible I began to understand that being dependent is actually a necessary part of understanding web app development.

I guess understanding that the front end is dependent on the back end and vice versa is a bit trivial; I get it. This idea of hierarchy, file structures, naming conventions and everyone's favorite "Best Practices" really began to hit home. To put it simply your apps success are dependent on them. The course I am following continued to repeat how important organization and laying out your application was in advance to coding. I just thought:

I get that all the planning is important and I WILL do it NEXT time but this is just a simple little app; I can just do it on the fly.

Now I learned the hard way, just why the course was stressing these ideas and methodologies at each step.

Skribble Drawing

I began building a small CRM tool with nothing more than a quick back of the envelope sketch of the app's dependencies. Tables were rectangles with arrows. The front end layout diagrams were even worse. A few days later I did not even understand what I sketched out and the 6+ hours of code I wrote was scrambled and broken. Time to start over and be a little more dependent on the process. Try to be professional and you will get professional results. Something I knew and believed in but didn't choose to apply in this situation

Maybe I thought I was smarter; Maybe I was just lazy; Maybe I was just too excited to wait to write some code.

One thing is for sure, I learned a lesson and I hope this article rings home with another newbie and underscores the importance of being a little dependent.

Everything fits together and conventions will save the day. Take Active Record for example, Tables are plural and Models are singular. Super important; things will break and flat out not work out of the box without that convention. So you are forced to just accept it, do it and keep it moving. Make everything this simple. If there is not a convention to push you into doing something, try thinking through it in advance first and come up with a plan. If you are making a Table (migration) use a free online sketching tool like draw.io to make the tables in advance and then build them.

In the front end, really get an idea of the Parent and Child relationship before you write a line of code. Props, callbacks and code organization are dependent on these and that is a good thing because when done correctly they will work as smooth as the freebie methods good old ActiveRecord::Base gives you.

To make a long story short, learn from my example and really try to plan. Ever watch a cooking show that has all their ingredients laid out; mise en place. Their process is quick and effective when the actual cooking starts. (Quick thought... did you ever wonder if they would use so many pans if they had to wash them all themselves....)

Post it notes to organize<br>

Try really hard to emulate this in your early projects. Spend time and set up a good clean plan with notes on how everything is dependent on each other. Think about your front end and back end. What routes do you need? Can you make helper functions or prevent repeating functions altogether by placing them in a parent React component? How and where will things live and be named in your file tree?

Bottom line is that I am learning that it is okay to be dependent especially when designing a web app!

Top comments (0)