Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts

Friday, January 20, 2017

CODECLAN WEEK 15 - THIS BABY CORNERS LIKE IT'S ON RAILS

So it's week 15 and the penultimate week at CodeClan.

The mood at standup has changed as cohorts are stressing about applying for jobs and the realization that soon it will all be over and we will be cast back into the real world outside cosy CodeClan.

Exciting times ahead but we still have work to do.

This week we are learning about Ruby on Rails, and using it as a back-end framework for our web apps to serve up API data.

Monday 9:00 standup and the talk was about the homework and about how much or little people managed to do over the weekend. It was hard. The task was to create a Guess Who Game app with Javascript React.

I completed some of it but did not get a fully working game. I'd like to say the main reason is I ran out of time which is partly true, but I did get stuck with a bug in serving up my API data (Rails where are you?). Thank goodness for one on one instructor homework reviews!

Lessons start with an introduction to Rails, and in a 2-minute whirlwind of commands, we had a fully functioning website, although just flat HTML it was a website. What was generated in a few commands that had previously taken us days to code from scratch? I can see the power of Rails and instantly like it. Coding is fun but if something like Rails can do the boring bones for you quickly I'm ok with that.

Hidden in the back of Rails are some great database tools and the plan this week is to use Rails as a server for API data. Gone are the SQL queries, and replaced by some simple Rails commands that seem to know what you are thinking before you do.

The afternoon lab was a pair programming exercise to set up an API server of our choice using rails and view data in the browser. Pizzas and toppings were served up as JSON data. Homework was in a similar vein and we had to create another Rails app that could serve up TV show data as JSON data.

Tuesday expanded on the SQL databases by adding multiple tables and creating one-to-many and many-to-many relationships and serving them to an API server. Something that was hard a few weeks ago in raw SQL became much more intuitive in Rails.

In the afternoon lab, we were let loose on our own to create an App of our choice with one-to-many and many-to-many relationships. I chose Formula One which had Drivers who belonged to Teams, that competed in Races at Race Tracks and had Sponsors and Sponsorships.

Wednesday's lesson was an introduction to Authentication on websites. A bit of theory and some practical code along. We added login signup and sign-in with password protection to our API data. If you're not logged in you can't access the data and the server bounces you out. Again Rails with an added Ruby Gem makes the whole setup fairly painless.

Thursday is a big day as it's the last day of lessons. No more code along, no more following the whiteboard, no more looking at what's on the projector, and no more class banter… One thing I have to say is that the lessons have been brilliant and very well executed. In my past life during long classroom training sessions I would have found myself nodding off (usually after lunch in a warm classroom) But I can say hand on heart having attended daily lessons for 15 weeks surprisingly this has not happened, not once.

So Thursday we marry Rails API server with SQL data to a React Javascript front end and have a full-stack app running with security. This is what we have been building up to over the last 15 weeks. I really should emphasize this more as it's a big thing.

So we have a FULL STACK APPLICATION running with ‘RUBY ON RAILS’ Serving API data as JSON to a REACT framework JavaScript front-end website that has security Authentication!!!

Brilliant and I know it might now mean much to some folk but to me Its awesome.

Thursday afternoon we were given a brief for next week's project. This is the final project and we need to present it on the following Thursday.

The brief is brief, to say the least. We can basically do what we want and use what we want from what we have learned. We can expand on what we have learned, build something, or just practice. We need to show evidence of architectural design and planning.

So that was week 15. Another great week, and a few more tools in my toolbox.

You might wonder (I did) why we did not just start with Rails from the beginning and have it do a lot of the coding for us.

But it was about the journey and the learning, I can see what is going on behind the scenes and if pushed could code it all from scratch (I have evidence on my Git hub to prove it --> Link)

Thanks again to CodeClan and their brilliant instructors. And to my fellow Cohort's top marks, you are the best!

<- And thanks to the unknown artist/s that did the pictures above, I snapped them in a shop window in Stirling and forgot to take note of who painted them, I like the style and colours ->

Monday, October 17, 2016

CODE CLAN WEEK 4 - FRANK SINATRA

So towards the end of last week, things ramped up with the complexity of the SQL queries:

"SELECT t.* FROM trainers t INNER Join ownedpokemons o ON o.trainer_id = t.id WHERE o.Pokemon_id = #{id};"

The weekend homework was of a similar theme so good practice. This time we had to create a Cinema database, and past customers, films, and tickets to and from Ruby methods. I had the car with me last week so unfortunately, the drive home was dead time. Listening to a Ruby Coding podcast made up for this.

I managed the bulk of the homework on Saturday. The Monday morning 05:43 train to Edinburgh gave me an opportunity to review and add to my homework and move on to practising Ruby in Code Wars

Monday - starts with the Scrum at 9:00 followed by a one-to-one review of the homework with an instructor. It's good to get some feedback on the weekend's work and some pointers on how I could have improved.

Classes begin with an overview of the internet and what is really going on when you make a request for a web page. All good stuff and I now understand what an HTTP: 404 error is. We were then introduced to Sinatra (Frank Sinatra) which is an open-source front-end framework for Ruby. A few examples later the lab was to create a Ruby calculator with a browser front end.

Tuesday - everything is coming full circle and the Pizza app goes online with a code along with the class. Building on the Sinatra from yesterday we combined the previous week's SQL and made a full-stack web application. Pizzas could be ordered via a front end stored in a database and then retrieved. This was hungry work so it was off to Pizza Express for lunch with fellow Cohorts. The afternoon was a group lab where we were tasked with creating another full-stack application for a shoe shop.

Wednesday - and we are introduced to 'Restful Routing' and applied it to our Pizza shop application. This completed the different actions that could be applied to the Pizza shop, by providing Edit and Delete (DESTROY) facilities. An afternoon paired programming lab let us develop our own record shop application using what we had learned in the morning.

Thursday - and following the 9:00 standup we are off into the world of libraries developing an application with many-to-many SQL queries that manage books, members, and how books can be issued. For this, the number of balls being juggled has risen considerably. Having to develop ruby code embedded into HTML and have it managed by Sinatra and having to think about joined inner tables is getting tricky. The Afternoon class is an introduction to Cascading Style Sheet (CSS) with instructions on how to improve the style and formatting of our HTML front end.

In the afternoon we were issued our first week-long project task. There is a choice of 5 projects that you can choose from and we have till Friday standup to choose from.

Friday - 10:00 stand up and I'm going with an Animal Shelter (...with a twist) application. We are encouraged to Plan Plan and Plan on Friday and not do any coding till at least Saturday morning. We will see!

So at the end of Week 4, I'm still really pleased with the course so far. It did ramp up again in difficulty this week, but I seem to be getting used to it now and my brain is taking the strain.

Monday, October 10, 2016

CODE CLAN WEEK 3 - PROGRAM LIKE EFEN REYS

So I have made it to week 3... Go me! last week ramped up a bit towards the end with blocks and enumerators. The weekend homework task was to create a Karaoke bar which was apt as I was lucky to be staying at the Crieff Hydro for the weekend. Sitting on my Mac in the bar with a beer coding had just the right inspiration and atmosphere. 3 objects were created Room, Guest, and Song. All had to interact with each other and it was fun to play with the objects.

Monday's standup was interesting to hear how my cohorts also enjoyed the homework. The Monday lesson began with a bit of thought for the day and a pep talk for the cohorts to make sure we were having fun and enjoying coding. We should program like Efren Reyes who is a famous pool player. When he makes mistakes he takes them on the chin and laughs them off rather than getting all stressed. So when our code is not working don't stress it, just laugh and work through it. A good mental attitude will help us code better.

This week is SQL week, so in the classroom, lessons introduced us to databases. Lots of CRUD (Create, Read, Update and Delete). This class was made easier by creating a Star Wars example database. Luckily for me, Jamie (my son age 8) and I watched The Force Awakens in the hotel cinema the night before so I was up on my Jedi.

Tuesday and the 'SQL' homework was summed up during the 9am scrum by a fellow cohort as 'SQ-Hell'.

The homework was a challenge to format SQL queries on a database to retrieve data with Increasing complexity. The last few questions required multiple inner-joined tables! The day progressed with more SQL and introducing Ruby into the mix. Programming Ruby to push and pull data from the database meant that data used in the Ruby programs could be persistent. So we created a Pizza Shop and started passing pizza orders into the database and removing them to an array of Pizza objects. Both Luke Skywalker and Darth Vader placed pizza orders.

In the afternoon lab, we split into pairs to program methods to recover data on the pizza sales and who placed orders.


The homework challenge was to map out the Facebook database structure and identify 'one-to-one', 'one-to-many', and 'many-to-many' relationships

Wednesday and SQL continues to advance; We moved the database calling logic out to its own class and passed it an SQL query as a string... Then placed method calls on the objects using a block to retrieve the data... Check me with all that jargon in one sentence.

Thursday, following the scrum we get a presentation from Cohort6 of the projects they have been working on for the past week. They are 10 weeks ahead of us and were assigned a team challenge last Thursday. A couple of words come to mind: 'Wow!' they achieved that in a week!; and 'PANIC!' we need to do that in 10 weeks?. The brief was to create a raw JavaScript web app. The range of solutions and functionality presented was brilliant. From Dashboards for Astronauts to Munro Bagging tool, to a Disease mapper. I still have lots to learn. Afternoon and it's back into class and we are still in SQL databases, only this time we have moved into the world of Pokemon. The lesson is to create Many-to-Many database interactions, between Pokemon and their Trainers with a Joining Table. The lab was to create our own databases with Wizards and Magical Items. Thankfully Thursday is social night. Some well-deserved beers and a burrito closed off the day.

Friday is standup at 10:00am and the issue of the weekend homework. I've not had it yet but I'm guessing it's SQL databases with joined inner tables with many-to-many relationships...

So to sum up... another great week at CodeClan => still very challenging => but I have some brilliant Cohorts enjoying the Journey with me => Roll on to week 4, where we get to add an interface to our Ruby and Databases.

Tuesday, October 04, 2016

CODE CLAN WEEK 2 - AND WE ARE PUTTING THE BAND BACK TOGETHER

So week 2 starts with a scrum and then a review of the previous week's homework. I was lucky to have 3 hours of quiet time on the train back to Aberdeen on Friday where I managed to get the bulk of the homework done. It did make me laugh that Jamie my son (age 8) and I were both finishing our homework in the kitchen on Saturday evening. Jamie had grammar and reading and I was making a fantasy model pet shop using Test Driven Development (TDD).

Monday saw us learning about cats, wizards, and wands to model classes and multiple classes... No, wait, that's the other way round. The homework was to continue with classes and model a speedy car (with turbo) and a slow car (non-turbo, Normally Aspirated). The type of engine would affect the car's performance and fuel economy which would be passed into the car object.

Tuesday was a brilliant day of coding along with an instructor to form a "simple" snakes and ladders game. 21 cohorts clattering away at the keyboard churning out ruby code. The game of snakes and ladders turns out to be quite complicated if you break it down into a program. Thankfully Object-Oriented Programming (OOP) simplified it into objects, boards, players, dice, etc.

Wednesday, following the scrum, was a whole day exercise where we were split into pairs and tasked with making our own objects and having them interact with each other. The world was our oyster, so as a team, we decided to put the band back together and form band-related objects including, songs, venues, and gigs. It can get very complicated very quickly but we met the brief of having objects interact with each other.

Thursday introduced us to the 3 pillars of Object-Oriented Programming (OOP) -> Inheritance. Abstraction and Encapsulation. This covered a superclass bird object and its sparrow, duck, robin, and penguin sub-class objects. All had methods quack, chirp, and fly. (except penguin who couldn't fly). Blocks were the final lesson for the day with a small lab. Thankfully this was Thursday's "social" evening so no homework and a chance to go for a beer with the rest of my cohorts. Blocks were hard, so much chat in the pub was discussing coding

beer_array = beer.select{ |beer| beer.type}.count

Friday is revision time and a chance to go over anything we need a refresher on from the week. Oh, and we get issued the weekend homework challenge.

So week 2 is in review. Another big thumbs up to Code Clan, my instructors, and my cohorts. I can't believe how much I have learned in the two weeks. I feel part of something special and really BIG...