This Week In Bloc Dev Bootcamp


Bloc has a cool feature within it’s platform that let’s you know if you are on pace. A few weeks back I spoke to a Blocstar that was telling me about a man going through the Bootcamp whose pace was always 100%. In true Coding Over 40 perfectionist form, I decided I was going to be that person. Here is the lesson-I am not that person, I don’t need to be that person and I am 93% on pace. I am happy that I am grasping concepts that don’t particularly come naturally to me because I didn’t study Computer Science in college, I actually studied the science of DNA and molecular biology in college, so that doesn’t help. LOLOLOLOLOLOLOL.

via Biocomicals

Moving forward, here is what I learnt this week in Computer Science aka Bloc.

 

Authenticating Users

via sendgrid

Before I started this particular project called Bloccit (a reddit-like product), I knew more about being a user to a web application than I did about how it works behind the scenes. What I learned this week is that, I really didn’t know much about very important features a user does that are included in all apps, mobile apps, e-commerce sites et al, and that is user authentication. User Authentication is where “we must authenticate and retain user information so that we know who the user is until they sign out.”
When you visit any application or e-commerce site on the web, you see that you will be asked to Sign Up or Sign In. My learning this week involved Rails coding to have this feature accessible in the front end. No, it isn’t just a simple html tag with a link_to where you want to go, it involves refactoring code associations so that you can authenticate your user. I’ll attempt to explain without diagrams. My lessons from previous weeks about slowing down helped me immensely with the task of authenticating users. My take-away was that I could literally get a job tomorrow where all I do is set up code to authenticate users for any and all applications on the web. This is great but would bore me to death if that was the ONLY job I did all day long. What Bloc taught me and continues to reinforce is that, there are simple concepts that are repetitive, just like any job, and then there are logical processes that will have you using the creative side of your brain. This must be completely understood when you decide you want to be a developer. I often say, I am a developer, not a designer, but one is not exclusive of the other. A good graphic designer who doesn’t know how to use HTML/CSS and Javascript will be halted in how far they can go in the web design game. Just like a good programmer will be limited in their skills if they don’t understand user behaviour and design. The graphic designer will spend their time at work thinking up beautiful creative ideas with no way to implement them, and the programmer will spend their time at work copying and pasting repetitive code with no way to make it attractive to the user.

 

Adding Code In One Controller Might Make Code In Another Obsolete

 

FULL disclosure here. This concept is pretty much the only time I get super frustrated. I’ll explain. Let’s say I define a method called create_new which simply creates a new user. Then let’s say after the user is created I want to redirect them to the landing page (welcome#index) of my app-GREAT! Now, let’s say I want to “associate” comments to a post this new user creates. Guess what? I will need to make sure that everywhere that user_id is related to a post is also associated with comments. Sounds simple right? It isn’t. If you forget to refactor or scope the associations in any file, things won’t work and you might spend all day figuring out why. I don’t think this is a beginner issue, I think this is an attention to detail issue and boy am I paying attention! Yes, error messages in your app are super helpful but often don’t point you to the actual error, it only points you to when rails decided it could process your code anymore. So having the knowledge to know where things might have stopped working is a super-power often unrecognised. Which leads me to:

RoR Is Freaking Fantastic With It’s Helpers But…

 


I was asked the other day by a fellow programmer who is just beginning his journey if RoR is a good place to start. My short answer to him was no, I do not recommend it as a starting programming tool. The long answer is more interesting.
RoR is loved by developers because it automates a ton of stuff that my generation of programmers have been doing manually since the 80’s. This is so great I really can’t explain. The caveat is, if you have no experience in a programming language like say, Python, or Javascript and HTML/CSS, when RoR tries to “help” you, it might throw you off. An example of this is, when I use a helper method but it only helps me so much. I then need to use my programmer brain to add code to actually use the helper. What RoR is really doing when it helps is using things like inheritance from classes so you don’t have to repeat yourself, aka DRY, stubbing out methods so you know which methods will be needed in your controller and models, and generating instance variables for you so that you can use them throughout your application. Where you might run into trouble with all this help is when you have NO idea how to call, implement or use these helpers because you have never written an object in Javascript or a variable in Python. I am blessed that I took the route of learning Python first, then Front End Dev suite next (Javascript/HTML/CSS) because that is the only reason why these RoR ‘Helpers” aren’t driving me batty. This isn’t to say if you have a love of this programming game that you shouldn’t start with RoR. If coding comes naturally to you, and you are one of those geniuses that I mentioned above who is always at 100% pace, then definitely start with RoR as it is the quickest and easiest way to get a full blown application up and running on the web. For those of you like me who have problems accepting help, RoR helpers can be “helpful” and make you feel a bit “helpless” at times when you can’t find out where your code is breaking because your helpers are trying too hard.

Tell me what you think about RoR helper theory in the comments. Have a great weekend!

Leave a comment

Your email address will not be published. Required fields are marked *