Qt's Home

The Story of a french guy discovering the world

Week 5 - Day 1 - OOJS, JQuery, and Hugs

| Comments

OOJS

Ok, dev things. You probably heard about Javascript. If you want to hear more about it you can check -Wikipedia-. Object oriented programming is a way to model your code in objects that interact with others. Again, Wikipedia has all the infos.

Yesterday, we had 2 parts in the day. First part was coding Javascript a bad way. Second part was the right way. The right way is apparently OO, Object Oriented. This allows you to actually make your code “look” like a developer’s code. I did some JS before and it was cool, fine, and interesting. But what I was doing was the first thing : Random lines of code altogether, not in objects, functions, anything.

Say I wanted a button to hide another button, I made that code in a small script, not organized, in a random file.

That is NOT the way to do it. It works when you want simple things, but then what if you start having a lot of lines, like you do most of the time? Well what happens is a big mess of a code that nobody knows about because in human langage none of that is understandable. When you make a complicated code to make your page glow, somebody has to read the whole thing to know what it does. If you encapsulate it in a function called “Blink”, people will know exactly what it is the moment they see it!

And then what if that blink was a function of the object “PageManager”? Well, then you have very understandable code, manageable, maintainable, and definitely object oriented.

Building JS code without Object-Oriented Programming is like trying to build houses without any plan. Yes, sometimes the house does not fall apart. But the house is not maintainable, you have no idea about what’s up with it, and if you do that, you’re a bad person and you should feel bad about yourself ;)

JQuery

JQuery is an open source library. People thought Javascript lacked function and could use simplification of some others, and so they built that tool with special functions, in Javascript, that give you that extension, that package of code people would use.

That simplifies web a lot. But then… That is a very risky path to take. People tend to think that because it is easy, they don’t really have to code it any other way that like a very long … bunch of code that does stuff with the page. No object orientation, no namespacing (Naming the things you just build, objects and functions), and in the end… No readability.

If you do that, well, just like this sentence in my first part : You are a bad person and you should feel bad about yourself!

Coding is not about making something work right now, coding is about building things, and when you build you plan, and organize everything. It works for Houses, Cars, Planes, and definitely for programming.

A bunch of code, be it JQuery, Javascript, Ruby, C, any langage whatsoever, should be organized.

So yesterday we learned that. In the morning we randomly JQuery-ed pages around the web, and on the afternoon we started encapsulated everything and naming what we did.

Hugs

I will not complain, not again. But what I did yesterday was talk. I talked about things in my life I did not like, feelings I had that are not out in the open all of the time. Dev Bootcamp tend to do that to people.

But then yeah, sharing with everybody around helps a lot in solidifying thoughts in my mind. In a way, it is my own therapy!

So yeah, yesterday, I talked about my life. I talked about why I don’t want to go back to France. Any other country but not France. I talked about what I felt… And so I got a lot nice feedback from people, plus hugs for the bad parts.

I’m happy and grateful I am among all of these people, and I am not looking forward to having to move on, out of DBC ;)

Comments