The one about sources for learning

Today’s post will be short, because I got sick lately so I had other things on my mind.
This is a short list on from where you can learn:

1. StackOverflow
I think the first position is self-explanatory, but I wanted to add something to it. Everyone knows that you can search for an answer to every question that comes to mind and that’s like the coolest thing ever. I think that you can learn a lot not only by searching for answers but by trying to answer questions that doesn’t have answers at the time. You can of course google the answer, but searching for an answer excluding stack overflow you can find gems and improve your research skills.

2. Official Documentation
Of course not every framework/library has any documentation, and most of them has it in pieces, but there are docs, that make my heart skip a beat. Getting to know new framework/library without their documentation is as hard as it gets, so if you are choosing new framework for your project – check documentation first and then make your choice.

3. Blogs
Well, maybe my blog is not a perfect example for it, but some of them are eye-openers. Let me toss you some examples just from the back of my head:
dev.to
stuffwithstuff (too bad it is not up to date, because it is a great piece of work)
foreverframe
martinfowler PS I’m secretly in love with this guy, this is how smart he is.
hypetech.co This one is good for diving into some buzzwords you hear now and then.

4. Books
Well, not the programming language books, because things are changing so fast, that sometimes it can be outdated before it meets the bookstores. But programming concepts aren’t changing that fast.
I didn’t read a lot of computer science books, but I can recommend at least two of them:
Code. The hidden Language of of Computer Hardware and Software. This book goes from explaining electricity to computer program and the journey between is great to read.
Software Craftsmanship It gave me big boost to my motivation, and explained what it is to be good developer.

5. Community
You are working as junior developer, and you want to know more about some specific topic? Have courage to ask and start a discussion at work.
You are unemployed and you have no friends with programming background? Maybe look for a group in your city, dedicated to some language or area of expertise. If there are none, start one. Start small, with e.g. mailing list, then try to meet for a beer/soda. If you are looking for people there is big possibility that other people are looking too.

If you can think of some other source, or you want to recommend me a blog or a book, leave a comment or send me direct message using form on the left side of my site.

The one about development environment

It’s time to do a side project, because my github account has been empty for too long. There is this idea that’s with me for quite some time. I don’t like to eat alone at the restaurant, but there are times when I don’t have a choice if I want to eat out. So I want to make web app, that makes it easy to find company to eat together at some place. I call it “Companeat

My technology stack will be:

  • Sails.js framework, because I want to write back-end in node.js
  • MongoDB database because I like how easy it is to implement with sails.js.
  • Front-end choice is still open for consideration. I am thinking Angular4 or React/Redux. This is new for me, so I am not really sure what are the upsides and downsides of both.
  • Docker, because I like things to be sandboxed and easy to manage.

For now I got my development environment ready for work. You can check how it looks on my github page here. This is how my workflow looked like (I won’t copy content of my files, because you can check them on github):

At first I created a project on github and cloned it. Then, inside project folder I made a Dockerfile with path: ./docker/dev/Dockerfile, and what I wanted to achieve was to have latest node, netcat installed, sails.js framework installed globally. Moreover I wanted default sails.js port to be exposed for other potential services.

At the end I wanted node modules to be installed and sails to be lifted (app to be started) at the end of container creation. This was the first tricky part.

I created shell executable file inside ./docker/dev/ path called entrypoint.sh with commands for installing node modules, creating log files and lifting the application. I copied the file inside container and executed (from the Dockerfile command), so when the container is ready it runs entrypoint.sh and it does what we told it to be done.

Now I had to write docker-compose.yml because I like to use docker-compose a lot. To be short: Every service is a stand-alone container, but when they are defined in one docker-compose they are linked to each other in a some sort of virtual network.

First service I named backend, gave it Dockerfile path so it knows the source from where it needs to be built. I made host (my computer) port 7331 to be connected to docker port 1337 (sails.js default port). I defined database volume to be shared between backend and mongo_db containers and gave my containers
-it flags as in docker -it container_name bash.

Second service is my database service. It is built from existing mongo image, that I found on docker hub. As I told I gave it shared volume with backend. The configuration of this service can change as the application progresses, but for now it’s hard to tell how to configure my database.

There will be probably third service with my front-end application side, but for now I will focus mostly on doing the back-end job, just a heads up so you won’t feel confused.

When you try to start a project yourself with nothing but my Dockerfile, entrypoint.sh and docker-compose.yml files, you carefree type docker-compose up -d to start your containers and DUM-DUM-DUUUM… you will end up with error message, one like this: 

This is because you are trying to lift an application, that hasn’t been created yet. From sails.js documentation you can read that you need to create new project before you try to lift it. This is the second tricky part. You need to go to your container. In my example it would be docker exec -ti backend bash* and from there you need to create your project. With my configuration the easiest way is to go to your root path (while still inside container of course) cd / and override /project folder with sails new project command. Remember that it needs to be empty! (You can see how I did that on the screenshot above). After that you can exit your container and you need to rebuild your container. The easiest way is to docker-compose up -d --build After that you should have your application up and running. You can check it at least both ways. First you can docker logs -f backend so you can see:

or you can go to http://localhost:7331/ and if you see this: 

you can start building your web application.

My article may be a little chaotic, I am still making my first steps in the blogosphere, so any feedback will be appreciated. Please comment, and if in any doubt or you need help with your programming struggles PM me. We can struggle together so you’ll feel less lonely 😉

 

*-i, –interactive=false Keep STDIN open even if not attached
-t, –tty=false Allocate a pseudo-TTY
(source)