My Experience And Thoughts on Remote Working as A Junior Programmer

About Me And My Job

I started my current job a year ago when I was an exchange student in Japan, I was second year in university then. I worked in the office for 9 months, after that my exchange year ended, I went back to my home university and started remote working since then. Until now, it has been half year.

I rent an apartment and lived alone near my university. I’m not full-time employed, I worked for about 5 hours a day, every day in the week because I found this schedule suits me better. When I’m not working, I go to classes, playing the piano or reading books.

My Half Year on Remote Working

good parts

The best part of remote working is much more free time. I don’t have to wake up early and spend hours on a crowded subway to the office, I could spend more time on doing whatever I want to do.

Also for me, working from home is easier to concentrate because there are fewer distractions.

My desktop and my friends o(●´ω`●)oわくわく♪

challenges for a junior programmer

For me, the biggest challenge is finding out the solution to the problem independently. As a junior developer, I don’t have much experience, when I encounter a problem that appears for the first time, it’s hard to get response from my colleges immediately, more often, I have to find out how to handle it by myself, sometimes it’s quite hard because I really don’t know what to do with it, and have to dig really deep on the problem.

The second is about confirming specification. When I just started remote working, it’s quite often to get confused with specification in junior year, and confirming specification online usually takes more time than face to face, and I have to make sure my colleges are available at that time.

Another challenge is about building up habits. For me, I don’t have a fixed working schedule, sometimes I find it hard to get myself backing to working from the lure of reading Reddit or watching Youtube videos. It needs self-discipline to keep myself from slacking off.

mental challenges

It’s easy to feel emotionally detached with other people. Since I live alone, and my colleges are all in another country, I feel lonely from time to time. I can’t keep being productive if I feel lonely. It’s not healthy to keep sitting in front of a desktop for all day, going out and networking is also important.

My Thinkings

I loved my current living style. I can get my work done and do whatever I want to do. For me, it’s not easy at first, half year later, I enjoy more and more.

Use class_eval and instance_eval

current object and current class

Everything is an object in Ruby, there is an current object and current class referred to in every line of code. We use self to refer to current object (there is no keyword for current class).

When call a method on an object, self(current object) is the receiver of the method. In a class definition, self(current object) is the class itself.

Though there is no keyword for current class, it’s easy to refer to as long as we know what is our current object.


Module#class_eval is used for modifying current class. It’s commonly used when we don’t know the exact name of class we want to refer to. For example,

def add_method_to(my_class)
  my_class.class_eval do
    def foo
      puts 'foo'
#=> "foo"

One example in Rails is putting common code for several models (just like what model conern does). For example, I want to add common validations for my models, I can create a module and use class_eval to add methods in classes that include it. In order to get that class, we need a hook method self.included, and put class_eval part inside this method.

module SomeCommonModule
  def self.included(base)
    base.class_eval do
      validates_presence_of :balabalabala


instance_eval is used for modifying current object (self), it breaks encapsulation, be careful with it.

An example is to change instance variable of an object:

class Foo
  def bar
    @bar = "bar"

foo =
puts foo.instance_eval { @bar }
 #=> "bar"
foo.instance_eval { @bar = "bbbbar" }
puts foo.instance_eval { @bar }
 #=> "bbbbar"

Simple Functional Programming in Ruby and Javascript

In Ruby, methods like map, reject, reduce are very handy to use. Recently, I came across Javascript functional programming, I found there are similar usages in Javascript.


map is used to transform an array into another

Here’s a simple example in Ruby, it accepts a block as parameter:

arr = ['m', 'o', 'n', 'k', 'e', 'y'] {|x| x + '1'}
 #=> ["m1", "o1", "n1", "k1", "e1", "y1"]

In Javascript, map accepts another function as a parameter, here is an example:

var arr = ['m', 'o', 'n', 'k', 'e', 'y'];
var arr2 = {
  return x + '1';
// [ 'm1', 'o1', 'n1', 'k1', 'e1', 'y1' ]

In ES6, you can also do this with arrow function, which is much similar to Ruby way:

var arr = ['m', 'o', 'n', 'k', 'e', 'y'];
var arr2 = => x + '1');
// [ 'm1', 'o1', 'n1', 'k1', 'e1', 'y1' ]


reduce comes very handy to apply an operator on enumerable elements

Here is an example of reduce in Ruby, it takes an initial value and a block applying operation on element

arr = [1, 2, 3, 4, 5]
arr.reduce(0) {|sum, x| sum += x}
 #=> 15

reduce can also accept a symbol as a parameter, initial value is default set to 0 for :+, 1 for :*

arr = [1, 2, 3, 4, 5]
 #=> 15

In Javascript, you can do this, the first parameter is a function that applies the operator, return value will be the next parameter that this function accepts, the second parameter is initial value:

var arr = [1, 2, 3, 4, 5];
var arr2 = arr.reduce(function(sum, x) {
  return sum + x;
}, 0);
// 15

In ES6, you can do this, also I prefer this way as a Ruby programmer:

var arr = [1, 2, 3, 4, 5];
var arr2 = arr.reduce((sum, x) => sum + x, 0);
// 15


Let’s have more fun in functional programming

A Pratical Strategy To Stop Procrastination


During this weekend, I was reading a book called Feeling Good: The New Mood Therapy by David D. Burns, which was recommended by a Coursera course Learning How To Learn. The book is aimed for curing depression, and it’s also very pragmatic for improving learning efficiency and stress handling.

A method called TIC-TOC (Task-Interfering Cognition, Task Oriented Cognition) for stopping procrastination is introduced in this book.

How to Use It

When you find yourself procrastinating on a certain task, for example, you have a report which is due next Monday, and you havent’t started writing anything until Friday night. You know you should spend the whole weekend writing this report, but the recent Netflix series attract you so much. And you spend the whole Saturday watching it. You are under high stress, and there is only one day left, but it’s too hard for you to get started. (I did this quite often (ノД`)ハァ )

Then you can using this simple technique:

  1. Drawing a table with two columns
  2. Writing down your negative thoughts that make you procrastinate in the left column
  3. Writing down your rational thoughts towards these negative thoughts in the right hand

Take the example of writing report, you may create a table like this:

TIC (Why you don’t want to get started) TOC (Rational Thoughts)
I don’t want to get started because I’m afraid of getting bad grades. The grade won’t be too bad due to my experience on writing reports. At least I won’t fail.
I don’t want to get started because there is no much time. Well, at least there’s still 8 hours writing it, it should be enough.
I don’t want to get started because I didn’t pay much effort in the class. Then focus more next time.

Hopefully this will make you relax, and go to write your report. ( ̄Д)=3

Finding Out Why You Procrastinate

The book also implied that there must be some reasons hidden behind related with your personal values. You should find these reasons out to prevent from procrastinating next time.

For example, the first reason I don’t want to get started because I’m afraid of getting bad grades. I will ask myself why I’m afraid of that.

I don't want to get started because I'm afraid of getting bad grades.

Why afraid of bad grades?

That reveals lack of ability.

If I should get a bad grades, does that prove my inability to study?

Probably won't, but I just hate failing, that makes me inperfect.

Then you’ll find out perfectionism probably is the reason that makes you procrastinate, not because Netflix series is so amazing. Next time, you will realize that perfectionsim is making you feeling stressful, it will be eaiser to get started.

Using Concern To Refactor Rails Model


Recently I’m working on upgrading a Rails 2.3 application to Rails 4.2 (Yes, it’s true, our company is still using 2.3 now, ( ‘Θ’)ノ( ‘Θ’)ノ( ‘Θ’)ノ). There are 5 models containing codes which are 90% the same. I tried to refactor them with Rails 4’s concern module.

What is concern

Rails 2.3 way

In Rails 2.3, if you extract code from model to a module, you need to create a module and put it into your /lib directory. To realize validations and class methods, you need to add a hook method in it, which was not an elegant way.

module Taggable
  def  self.included(base)
    base.extend ClassMethods
    base.class_eval do
      scope :disabled, -> { where(disabled: true) }
      # scope, validations, after_save .....

  module ClassMethods
    def find_with_tag(tag)
	 # .....

Realization with concern

In Rails 4, you can eaily realize it by creating a module extending ActiveSupport::Concern and include this module in your model.

module Taggable
  extend ActiveSupport::Concern
  included do
    scope :disabled, -> { where(disabled: true) }
  class_methods do
    def find_with_tag(tag)
	 # ...
  #put instance methods here


  • If you want to know which class is using this module in a class method, you can simply call self. For example, I want to cache class method find, then in my taggble module, I use
class_methods do
  def some_class_method(id)
    Rails.cache.fetch("#{}.find(#{id})", :expires_in => 15.minutes.to_i)
  • If it’s in an instance method, use self.class instead
def some_instance_method(id)
  Rails.cache.fetch("#{}.find(#{id})", :expires_in => 15.minutes.to_i)

And the code is more elegant (^m^ )クスッ.

life ( 4 )
music ( 1 )
programming ( 12 )
spirituality ( 1 )
language-learning ( 1 )

About Me

I'm a university student in the last year, also a web developer. I love exporing cultures, learning languages and making BGM music!