Learning

Introduction

Aaaaah, prototypes… How many blog posts did you read where prototypes are listed as a must-know caracteristic of the language? How many times senior developers told you about prototypal inheritance? I’ve spent quite some time avoiding to learn more deeply about this thing. I got tired of procrastinating, so I wrote this thing.

Continue reading No, not inheritance, please call me delegation…

Read more

Curry

Introduction

Well, time to teach myself something I don’t understand again…
In this article, we will explore a technique called currying. Currying is another concept in functional programming. It goes as follow: when a function expects several arguments, we break it down into successive chained functions that each take a single argument.

We reduce the arity of each function to one ( arity is the arguments length of a function ). Let’s see some examples.
Continue reading Explaining currying to myself

Read more

What I worked on

It has been more difficult to find the time this week. I managed to squeeze in a few hours this week-end. So, the catalog is starting to take form. The game’s cards are classified by classes and sorted by mana cost. I added previous/next buttons to switch pages ( 14 cards are displayed on each page ). I had a little challenge when I had to switch from one character to the next. When you click next and the current character has no more cards, the application switch to the next character and displays its cards. Took me some time to figure out though.

I mostly worked on the HomePage this week-end. I styled the navigation bar slightly, and I added buttons for the Add new game and Create new deck actions. The new game action opens a modal where the user can choose 4 things:

  • its class
  • its opponent’s class
  • its deck
  • the outcome of the deck

The modal is done and the front-end logic is handled.

Next week goals and code

For this week, I will try to finish the new game functionality by inserting them in a database and listing them on the front-end. I think the future statistics page will display a list of the latest games saved. Then, I will start the creation of the new deck functionality. This might take a while. Not quite sure how a want to do it yet. I think I will add an action on each card in the catalog to allow the user to add the card to a deck.

The code can be found here

Read more

Introduction

I write because it helps me retain informations. Whatever subject I’m studying I force myself to put it into words, like I’m teaching someone else. My main purpose is not to teach others though, but to teach myself. We always think we understand something, until we have to explain it. Those who know, do, those who teach, do it better. I’ll try to teach myself closures in this article.
Continue reading Explaining Closures to myself

Read more

Every week, I write a blog post about my progress on side projects. I explained my thought process in this article last week. I also detailed the first project that I wanted to work on for this month.

Week One

The stack choice

For the front-end, I went with React and create-react-app. It greatly reduces the headache of getting everything set up. For the back-end, I chose express. For this project, this is more than enough to do what I want. I’ll also use MongoDB for the database and I decided to use semantic-ui for the UI framework. I used material-ui before, so I went with a different one.

Setting things up

There are two different parts in this project. The root of the project takes care of the server side ( express + mongodb ). Inside this root folder, a /client folder holds the front-end that was set up thanks to create-react-app.

The first difficulty that I had was to connect both parts. How do I inform the front-end and back-end to listen to each other with the create-react-app setup?

Thankfully, the documentation links to a tutorial that explains how to make create-react-app works with an API. Right here if you’re curious. The front-end and back-end are run concurrently thanks to the npm package named concurrently ( convenient ).

And after that, I could start writing my code.

Hearthstone API

To get all the informations about the game’s cards, I found an API at this url. Well documented, easy to use, and I have all the informations I needed.

React Router

This one made me sweat a bit more. I wasn’t aware a new version of React Router was released. It took me some time to understand how the new one worked. ( BrowserRouter and Switch ).

Starting to see some results

I started with the cards’s catalog. I had to figure out the call to make to get the cards I needed ( hint: collectible=1 ). After that, I filter the cards by classes and sets in the front-end. Hearthstone has a “standard” mode where only the most recent cards sets are used.

The catalog functionality will ressemble the one in the actual game. The user should be able to sort them by name, mana cost, cards set and classes…

Code and next week’s goals

Here is the code on Github

For next week, I will try to finish the catalog functionality with all the sorting and filters. If that is done, I’ll start adding some deck actions ( deck creation, adding cards to deck from catalog … )

See you next week!

Read more

Why?

Whatever craft we are pursuing, we all need to build something to gain experience and mastery. Obviously, software development doesn’t escape this reality. Theory is important but using the knowledge in actual projects and solving problems enhance our comprehension of the subject.

Side projects always seemed amazing to me. Building something during my free time to solve a problem I have, or a problem others may have is a big reason why I started to code. The more I learn about programming, the more I realise its powers.

Like many developers, I started a lot of side projects. Every time, the pattern was the same. I was excited for a few days, perhaps a week. Then, I started to encounter more difficult problems, or I realised the project would take a very look time or life happened and I stopped working on it for a few days…

My Github account is a graveyard of potential projects that I just couldn’t bring to life. Not mature, fully developed, married with two kids in a big mansion kind of life. A gigantic proportion of these projects didn’t even go past the embryon stage. Every mistake is a lesson. Which brings me to this post.

A possible solution

One of the problems was that I did my thing alone. Nobody knew about it. And I totally dismissed the power of accountability. You will know about it. I’ll show you my progress, every week. I’ll just need enough discipline to write a blog post about it once a week, during the week-end. I’ll mention the problems I faced, solutions I chose, and how I managed ( or not ) to spend time on the side project I am working on.

My rules

A lot of people came up with similar “frameworks” for learning and side projects. Here are the rules that I chose. These are totally arbitrary:

  • Choose a project. No languages, libraries or frameworks restrictions.
  • Spend one month on this project
  • Just build a MVP ( Minimum Viable Product ). Don’t get drown into details. Get the big picture
  • Code will be on GitHub. Every blog post will link to the repository.
  • After a month, deploy the application, whatever the state is. From there, either choose to keep working on it for another month, or switch to a new project
  • If the project is over before a month, start a new month with a new project
  • Report your progress, problems and failures each week in a blog post

One month seems to be long enough with the time I have to create something decent. One week would be too short. If the project is going well and I’m enjoying it, I could spend another month on it, keeping the same rules, but updating the requirements of the project. Reporting my progress will probably help putting things in order, and not going in several directions at once.

First Side Project

For the first project, I chose to do an application related to the Blizzard video game HearthStone. Players build decks with cards based on the Warcraft world. The application should allow players to track their records and their progress with their different decks:

  • Users can access a catalog with all the cards and build decks.
  • Users can export their decks to the game.
  • Users can add the outcome of their games.
  • Users can see how their decks perform against other classes.
  • Users can login with Twitter or GitHub.

That should be more than enough to get me started.Let me know what you think and I’ll see you in a week!

Read more

I recently found out that it’s very easy to get lost in the daily challenges of being a freelancer. The lack of real structure around yourself can make it difficult to distinguish code written for work and code written for play. It has become a bit difficult for me to say stop, my work for today is done, without feeling a little guilty about something. It can be how productive I was during the day, or I perceived the quality of the code I wrote.

Those things can be solved by a different mindset and a strong discipline. Work starts and stops at a certain predefined hour, except emergencies. Whatever code I write after or before those hours, it’s playtime.

The other problem I need to solve is, what do I do in my playtime? I like to learn new things, but I also need to become better. Learning something new is quite different from working on your fundamentals. So I chose two courses of actions in my case:

  • Learn a new language: I chose C#.
  • Choose a engaging side project to work on.

There is not really anything crazy behind the C# choice. I love to learn using Treehouse and they have a course on this language, so that’s really all there is to it. It’s also something quite different from Javascript, which is the language I mostly use. I believe it’s always important to explore new things.

Here comes the real problem: what side project to choose? I thought about this quite a bit. I still haven’t found anything serious yet, only a few ideas. But I think I can list a few things that a side project should have in order to become interesting:

  • Be personal. Solve one of your problems. If the project is something you can relate to, it will be easier to motivate yourself to work on it and/or make it better.
  • Be in the realm of possible. This one is about your current skills as a developer and also about being realistic. I love video games, but I don’t believe trying to make the next World of Warcraft could be considered a good side-project.
  • Have a future. It can scale. If more users get to use your project, that would not be a problem.
  • Be open source. Two reasons: you increase the chance of having other people use your project. And it could become easier to find help if you get stuck at one point. It would most likely help with the scalable issue.

So, that is what I think a side project should have to make me work on it on a regular basis. I decided that I wouldn’t start a side project until I become quite sure that I would spend some time on it and be proud of it in the end.

Let me know if you think a side project should have different attributes. How do you choose your side projects?

As always, feel free to share and comment.
Have a nice day!

Read more