bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.

Friday, September 19, 2014

Why I am using git flow and you should too

I have learned many things in only 3 months real Rails Engineer(not just on tv) and I have been a slacking a bit on sharing those skills due to the increase workload I continue to take on. I did want to take the time and share on `git flow` and why I am using it on my overhaul of my breakable toy app, Chuych.

While attempting to work on my chuych app in the past 3 months I have notice that my commits are a bit all over the place and I lack the focus to complete anyone thing, for example sticking to one design. This is why I have taken it upon my self to use git flow (What is git?).

 My goal has been to give my personal projects more of a focus lately since they have been ignored. I spent a lot of time trying to get up to speed in Ruby, Javascript, and even learn iOS on the side. I can say I really lost focus on maintaining my own code portfolio. I have however been taking work home and spend a couple hours on the weekend working through refactoring and bug tracking in my work code.

I have slowed down on my learning of new skills and languages and restricting myself to only learning things that will increase my productivity at work and make my chuych app more robust (This will not effect my iOS learning). I have spent the past 2 weekends building out my test suite and it is at a point where I can no just add test when I implement new things.

Git flow  is feature of git where you can speed up your workflow, in the command line, by creating structure in your branches/commits with shortcuts. This feature will create a branch, merge a branch, and close a pull request in 2 commands. It is not uncommon for someone to work on their personal app and commit and push everything on their master branch. There is no shame in this if you do so; I was doing this up until last month. I am now using git flow to create separate branches to organize my thoughts and focus on one feature/fix at a time. This really helped me finish the last of my testing and will hopefully help me build out my design stylesheets.

If you learned rails through any tutorial they team you to commit as soon as you are done with a full feature or full programming thought. They sometimes briefly teach you about branches, but from my recollection, it gets abandoned rather quickly in the tutorial, or at least I abandoned it. It really isn't necessary to be so verbose in your branching your commits, but for apps you would like to keep around for awhile, structure is what will keep your sanity.

My recommendation is to try using `git flow` for one feature of your site, if you are not already using a similar method, it will bring sanity back to your app development just as it has mine.

The Process:

To begin you will need at least 2 branches created in your app. I named one master and the other develop, but feel to use any naming convention.

  Master Branch - This branch is standard, especially using github and coming from tutorials. I believe most Rails developers and even possible back-end git users use this branch name. If you are using heroku or another deploying method, it can be deployed from here.

  Develop Branch - This is the branch where all you code will be merged to first and tested.

It is important to keep master separate in case you merge a breaking changes or something goes wrong, the merge history should be primarily merges from develop unless its a hotfix (to be explained later).

You can also create staging, release, and QA branches but I am keeping it simple for now and suggest the same.

Install:

There are complete git flow installation instructions on the web but I will provide the cliff notes.

Start by type `git flow init` in the command line and proceeding with the steps prompted in your terminal. They will ask what branch your feature will be merged to, my recommendation is to use the defaults on the screen and the develop branch to merge to.

Workflow:

Again there are many workflow examples on the web but I will provide the cliff notes.

In my current we follow the current structure.


  1. Create a feature branch `git flow feature start <desired_feature_name>` while on the develop branch. What ever branch you are on will create the new feature branch, so make sure you are on the correct one.
  2. Push the branch to git `git push origin <new_feature_branch_name>`  this will create the branch on github, be sure your git remote is set or you will be prompted the first time. 
  3. Open pull request, on github you can use create a pull request compared to develop for peer code review. Instructions on creating a pull request.
  4. After feature is complete `git flow feature finish <chosen_feature_name>` this will merge your branch to develop and delete your feature branch locally only. 
  5. Now the final can be of your choosing, but you eventually need to merge to master and then deploy once tested. At work we would now create a release branch using `git flow release <release_number>` and repeat steps 2-4, replacing the final merge to master instead of develop.


*a hotfix is a pressing bug that will actually be merged to the master branch instead of the develop first. You will create these off master and follow the same steps 2-4.

Why:

So why do it this way? My answer is again to stay focused on feature at a time; it will also help when I actually get my app built out, I can work on multiple feature at a time if I get stuck or choose to work with another developer. I also will start using release cycles once my app hits 1.0 (i.e. has some sort of front end design).

If you are reading this and still learning rails in hopes to get a job doing it, I recommend trying this out, if it doesn't work for you, you can always delete the extra branches continue to push changes directly to master. If you do decide to do this, it would help you in the eventual interview since most companies use this or a similar technique in the development.

If you have questions or if something was unclear, please shoot me an email or leave a comment.





Tuesday, September 16, 2014

Managing Dependencies with POODR

I recently spent some time preparing a talk on Managing Dependendencie, a topic cover in the POODR book by Sandi Metz.

Programming is great:

I came from  a sales position where the only keeping me there was the paycheck. I am person that enjoys perpetual learning and not that sales can't be a perpetual end to learning it can also be a drain. I now have the ability to now make things that matter and be a part of something rather than just sell the idea of it. I now have the privilege of maintaining an application with a lot of legacy code.

In sales I have learned to observe the situation and I have notice that programmers are notorious for knocking the previous developer. Rather than understand the code they choose to curse the code for its brittleness and unending work to update with change.

Dependencies:

A recurring misstep in the code I see is the problem I see in my work code but as well in other is change is hard to work due to the large amount of dependencies in the code. Dependencies are the messages sent between objects. In the example below, there is a message being received in the initializer and an outgoing message in the :gear_inches method.


*Please note that the attributes are incoming messages, chain-rig, cog, rim, and tire.

Problems:

The problem with dependencies is that there are too many. The idea of creating Practical Object Oriented Design is to have the least amount of dependencies.

















Solution:

Writing maintainable code is another goal having a practical design. As a programmer you should be able to revisit your code and easily understand what is going and also easily implement a new change. In the above examples, the Gear is too dependent on knowing about the Wheel and how its made and which order the rim and tire should be placed in the argument.

The suggestion is to instead pass in the wheel as an argument; this free up the ability for the gear to depend less on the Wheel but also allow other parts of the bicycle without getting the way of the Gear and Wheel relationship.
















I hope this post has been useful and also hope to share more info on the subject in future post. *Examples came from the book Practical Object Oriented Design in Ruby, I highly recommend this book to all new and experienced Rubyist. 

Editing a commit after the fact

Multiple times I have found myself in need of editing my commit messages due to typos or unclear messages. I have that the use of  `git commit --amend` and `git reset -- hard`.

Having a short and concise commits have been useful for myself, especially I have had to start and my feature stories multiple times during the course of the month.

Another practice in reading code to learn is reading each commit(line by line) to get a good understanding on what the code is doing. Reading commit messages on code that you have no association with could feel as an unneeded experience, but my recommendation is to do so to grasp a better understanding of the code in general.

*update* If the terminal is your default way of using git then you will need to know enough VIM to navigate. I recommend vimtutor or vim adventures. Of course you could always use the github GUI but thats doesn't feel like coding :)

Friday, September 5, 2014

How to Install Rspec

*For some reason I thought I wrote a post on this, but it seems I have not.

Gems are wonderful make it easier to add complicated functionally to your add. A large number of gems can be installed and implemented in only a few steps. Installing Rspec can be completed in a few steps and can be even easier if you install in Rails.

1. gem install 'rspec-rails'

If you are working in a Rails application, it is recommended to include the `rspec-rails` gem because of it close association with Rails generators. If you are not using Rails, then the plain `rspec` gem will suffice. Once the gem has been added to your gem file, it may be implemented using `bundle install`

2. Create spec helpers and config files.
This is even easier,the command need to finish the install is `rails generate rspec:install`. This will create all the need fils for add any additional functionality to your testing suite, including auto testers and stuck/mock libraries.

*Please note if you choose to create an application without rails, you will need to install those file manually. I spent 2 hours in a starbucks once trying to figure that out, but that story will be for another post.

3. Place all test in the `/spec` folder and append the `_spec.rb`. This will ensure that the `rspec` command runs all test.

For more clarification on installing Rspec, please see its Github readme. I also recommend a trying it our, since the best way to learn is by doing. Checkout the the examples from the Rspec book.

Also checkout: Ruby for Newbies: Testing with Rspec

Thursday, September 4, 2014

Finally building a complete test suite for chuych

Now with 10 weeks of real work experience I have gained more experience than I could have ever imagined.

I am shocked to find that my first commit to github for my chuych wasa whole 3 months later. My previous goal was to gain enough knowledge after beginning work to keep up with my daily workload and I feel I have just reached that point.

My second goal as of August was to start committing to my personal projects once again. I have succeeded by providing my first commit August 10th.  My hope is now to complete my test suite by Sunday, which will include Features and Models (using Rspec).

I am looking forward to writing a complete test suite to ensure my app is free of most bugs. I will be focusing some future blog post to my current work in testing. Once I complete this task I can move on to improving the front-end design, which has been lacking since it's inception.

TDD? More and more people I come encountered with do not use TDD and it's not a mystery that I do not use this form of testing, but the concepts I have learned from thoughbot's upcase TDD workshop has been more than enough to learn the idea of testing in Rspec. Whether you test before or after, testing is still the same, and I highly recommend learning TDD is you are interested in writing better test.

Testing small has made it easier for me to get the ball running and getting an overall idea of what needs to developed next. I currently have tests for 3/4 of my existing models and plan to move on to Integration/Feature test which will tighten up the functionality of my app. I have found that the geo-searching was very buggy and the rendering of the Javascript was also hit or miss, by testing this will help identify the problem and fix it.

For a tip:
My recommendation is to start with validation testing to help get past the awkward part of testing,  I have an example of that below.

Tomorrow I will write a post on setting up your test environment.





Monday, August 25, 2014

How I defeat Impostor Syndrome

What do I do to defeat Impostor Syndrome?

I realized I could of title this blog post differently, 10 ways to defeat Impostor Syndrome, but I feel there are only 2 things I did to defeat Impostor Syndrome.

When I started attending Ruby Meetups last fall I heard of the term Impostor Syndrome briefly but never really took the time to look into it. I quite honestly never heard of the term prior to my journey into web  development but it seems to be an issue that actually all types of people and fields.

I listened to the a recent podcast unrelated to programming where the host explained his suffer through impostor syndrome while attending his first classes in med school.

"Impostor Syndrome, is a psychological phenomenon in which people are unable to internalize their accomplishments."

In my previous career I made a huge effort to obtain a job in sales without any prior sales experience. I spent a good amount of time researching interview and sales techniques to only be turned down for multiple positions because of my lack of experience. I was even turned down for my first sales position, but due to to the first candidate failing their drug test (which I found out later from a co-worker); I was called back a week later and offered the position. I of course accepted the position but couldn't help but spend the next two years thinking that I did not belong there.

The thought that I was never good enough and that I would eventually be figured out as a fraud (hypothetical)  crossed my mind multiple times during my time in sales. Within my first 2 weeks I closed a significantly large deal and didn't make a big deal about because I thought it was not good enough.  My drive became not settling for skating by and doing just enough. This unintentionally caused me to become promoted twice within 4 months.

Accept It

In my own words, Impostor Syndrome is not something that ever goes away, I realized this buries the lead, but if you understand this concept it can be a great way to defeat it daily. Similar to fear, it will never leave you 100% in life and even the fear of failure will always come up in your career. I know I am not the best at software engineering but strive to be a decent great engineer.

It's possible in sales to become insincere due to their lack of confidence and end up presenting a false image of confidence. It is highly possible you have to fake it to make in a career, but it only alienates you from others putting you on a shaky pedestal. By accepting your faults it makes it easier to understand what areas you might need help in and helps you challenge Impostor Syndrome head on.

My suggestion is not elevate yourself into something you are not, but rather learn from your peers and and openly admit that you do not know. Within my first week in sales I was told to never tell a customer that you do not know, but rather tell them you will find out. I sit here writing this post today with problems I have yet to figure out in Ruby and no plan to solve them. I do plan to research my answers, but I also plan to reach out for help and assistance when stuck.

There is no doubt the company I work for today took a chance on me, as an aspiring engineer with no experience, and I feel everyday that I must prove that their decision was worth it. I swallow my pride knowing I made a leap so many strive for and keep my eyes on the next goals of the day. My hard work does not stop because I have gain employment, it only just began.

I am a bit of a listener and love learning from others, not only in programming, but in life generally. I have learned that even the most decorated and influential people in my life deal with Impostor Syndrome. I have also the realized the individuals who have no need to worry about Impostor Syndrome are the individuals who are stagnant in their careers and abilities. Most can grow content in a position where they have expert knowledge in, never challenge or pushed to try something new or hard.

Impostor Syndrome is great way to encourage yourself to strive harder and admit your weakness to eventually strengthen them. Use the fear of not being good enough to work on areas you can improve in.

Do Something(Step outside you comfort zone)

I heard of how a study was conducted on monkeys where they placed 5 monkeys in a room where bananas were placed in the center room, only reached by access of a rope. When a monkey could make it half way up the rope a man in the same room used a firehose to spray the monkey off the rope, cruel but stay tuned for the meaning. Eventually each monkey tried until they realized the futility of trying for the banana.

The second stage of the study involved each monkey being replaced by a new monkey, which was quickly discouraged by the others not to attempt for the bananas without the aide of the water hose. It got the point where monkeys in the room were replaced by individuals that had not experienced the fire hose but knew to discourage any new monkey.

When I started into web development with everyone telling me how hard it was, I even avoided the Hartl tutorial because everyone told me it was very difficult. I smile when I think about that because the tutorial itself it not as difficult as perceived, seeing how all the code is handed to you to type into your IDE, the only impediment is starting.

I started an online study group on the internet because I knew I needed help from others and sought out to associate my self like-minded individuals. I had a local meetup available to me to meet and chat with other local Rubyist but it only occurred once a month. The group I started was RubyNewbies and it propelled my learning immensely. Prior to RubyNewbies I had the fear that I couldn't complete the most basic of applications in Ruby, but once I realized the best way to beat that was to do something about it.

I pushed my self into a role of sharing my knowledge of what I learned literally a week prior in order to identify areas for improvement in myself, if I could explain it to other Newbies, I did not know it well enough. When I first heard of the Odin Project I jumped into the Rails Study group to capture missing knowledge needed to eventually get a programming job. I chose to lead a separate study group in order to propel my weaknesses into strengths.

Every video I recorded I had the fear that I would be asked a questions I could not ask or be given a problem I could not solve, but instead of quitting I accepted the challenge. I chose to record the videos to not only keep myself consistent but also make it available for others. There were multiple times where I stumbled over my own slides and even said I don't know but I chose to continue my journey towards learning Ruby.

I eventually completed the Odin Ruby curriculum, even while accepting a job as a Software engineer and moving 100 miles across the state of Florida. My determination to prove to others that I could make was really a way of proving to myself that Impostor Syndrome could be defeated. When interviewing I flat out said I did not know, but I could find the answer in a Google search. I even said stated that I was barely a decent programmer, but I had a strong desire to learn. Selling my faults with my strengths was something I would never of done in a sales interview. In sales I avoided sharing my weakness in order to sell myself as the Impostor. This is not a practice of all sales professionals, but it's what I thought I needed to do to get by.

Accepting that Impostor Syndrome is real is the first step but actually doing something to challenge it head on is the second step. I am glad I had the opportunity to make this career change and come to realization of how to accept and change my outlook towards Impostor Syndrome.

Summing it up

There are intentionally only two steps to defeat impostor Syndrome to avoid getting lost in a perpetual planning cycle. My goal is to encourage others with a story and 2 step process to create more encouragers.

Impostor Syndrome is unfortunately not something you can defeat once with no need to worry about in the future. If you are like myself with goals, dreams, and aspirations you will deal with this regularly. The key is accepting it and deciding what you are going to do about it and if you feel you are in a position where Impostor Syndrome is not a problem, I have to asked: Are you stagnant in your personal development? Are you helping to grow others by creating an encouraging environment?

I am not an expert in Psychology, I have some life experiences and hope that this post can encourage those that read it. This is a post I have wanted to write for awhile but coincidentally did not feel I could for reasons implied in the above paragraphs. Writing is just one way I defeated Impostor Syndrome today.

Best of luck with your journey and thanks for reading.

Wednesday, August 20, 2014

{}.tap have you seen or used it?

I have never heard of the tap method but am glad I have made the discovery. I planned to use it in my code at work, but have not had the opportunity yet. I find lately I have tried to force many new concepts in my code, but have yet been able to.

Its probably better not to force them. I love the idea of the <=> operator but have not used it once in a real life experience, even in code quizzes. I will probably used the {}.tap method sooner and actually tried it out for the first time yesterday, but ended up taking it out in a refactor.

Check out this blog on the tap.{} method.

I am finding out that there is a right way to Ruby and wish I read Eloquent Ruby a lot earlier. I spent too much time not reading books and going through basics of Ruby. I highly recommend every new Rubyist to read Eloquent Ruby. It is a great guide into Ruby and explains a lot of questions about when to how to write Ruby with best practices.