Rapid Rails Girls
  • Home
  • About
  • Contact

Summer is over :'(

10/10/2014

0 Comments

 
Thursday was the very last day of our Summer of Code at SoundCloud. In front of our whole team and a handful of other SoundClouders we presented what we've been working on and what we have been learning over the past three months.
PicturePresents, yay!


The Summer of Code has been ... well, absolutely marvelous. We probably still can't believe how much luck we had to meet all those wonderful people and to work together with the most amazing coaches! We are full of thankfulness and will be indebted to them for ...like ... forever.

After learning to code for three months, we both made a decision: Coding is awesome! We will continue!
This blog won't continue, though. But we would like you, dear reader, to continue following our steps,  give feedback, ask questions, or simply stay in contact. You can still send messages via our contact page or connect with each of us like so:

Kathi
I do very much appreciate every code review on my project(s) on Github (github.com/kat-crumbs). 
Connect with me on twitter (@zw_ka) but bare with me if I only rarely use it for tweeting.
Connect with me on XING and / or LinkedIn. 
If you know about any open software development internships or junior position, please let me know :)

Brigitte
Same here! You can find me on twitter (@gobridgego), LinkedIn and XING.
This is me on Github: github.com/BriocheBerlin
Advice as well as open positions are very welcome. So please spread the word, thanks!

Our summer of code was amazing. We had a great time and we do think that we learnt a lot. A huge thank you goes out to everyone involved! We already miss you!
<3
0 Comments

Subliminal message: Download Carpet Diem!

1/10/2014

0 Comments

 
Picture
Sorry for keeping quiet for such a long time!
What we have been up to:
  • Went to Julius' last regular Whiteboard Talk. This one was an introduction to data structures and algorithms. 
We learnt how to note down complexity using the big O notation: in a collection of unsorted data it takes a certain amount of time to find something. The time to find something can grow:
Proportionally to the collection of data: O(n)
It can grow slower O(log n)
It can grow faster O(n2)
It can be a constant O(1)

Choose the right algorithm for your use case! As always, it is about decisions.
We learnt about sorted arrays, linked lists, binary search trees and hash tables. 

  • Had one-on-ones with Erik as these 'are a thing'. Very useful, now we just need to turn our insights into actions...
  • Threads. In order to know about threads, it's good to know first about...
    • ... serial: start with the next item only if the one before is finished
    • ... concurrency: start, stop, work on the next item do the same, go back to first and continue… and so on (it’s doing two things not necessarily at the same time, but at once)
    • ... parallelism: working on two things at the same time

Picture
Concurrent muesli
  • Threads are a structure that gives you concurrency, and potentially parallelism. CRuby (MRI) is limited to concurrency. JRuby and Rubinius allow you to have true parallelism. It can make your program faster but it changes the behaviour, might give it a weird order - be careful if you’re sharing (mutable) data across threads! To start a new thread just type Thread.new or Thread.start. A thread doesn’t wait until its block is executed, is goes to the next thing straight away but  .join  or .value tell the thread to wait until its block is executed.
  • Also we learnt binary and hex numbers.
Picture
  • compiler / interpreter:
  • CRuby is an interpreted language, there is no compiler. An interpreter reads through your source code, parses it into an abstract tree structure and figures out what to do and does it. Compiled languages are C, C++, Go, Java, Rust, Scala… A compiled language goes through two different steps. The first is the compilation, it compiles the code into virtual machine bytecode or machine code, depending on the language, into a new file. This file can then be executed without having to compile again.
  • Databases! Databases are like spread sheet, but better! 
DB ->  Rails Controller 
SELECT   -> index/show
DELETE   -> destroy
UPDATE   -> update
INSERT  -> create

SELECT and DELETE statements have the exact same structure. 
You can join two tables. You might need this when you wanna retrieve information from both tables:
SELECT users.name, pets.name
FROM pets
INNER JOIN users ON users.id = pets.owner_id
WHERE users.age > 30 
  • Most importantly: We turned Carpet Diem into a gem! Yes, that is right, now you too can play this awesome game! So off you go, download it! (Thinking of a name for a publisher: What about Peace Pretzel Entertainment?)
Picture
0 Comments

Let's do some dr... ehm... drawings

24/9/2014

0 Comments

 
  • spoke about how to find out whether a class has a method. You can use .methods or .respond_to?('something')  or .include?('something')
  • learned about another form of looping: for … in. You can use it on any object that responds to each.
          for i in 1..5
          puts i

          end
  • learned about next and break. Next skips whatever comes after it and returns to the beginning of the loop. Break takes you straight down to the end and ends the loop.
  • spoke about password protection. HTTP has a basic authentication which can be called in the controller of a Rails app and looks like this: http_basic_authenticate_with name: "rgsoc", password: "secret", except: :index  .... this is, well, okay. But if your code is open source, you'll want some safer option because everyone can see your password on Github (or wherever you have your code). But given your app is deployed on Heroku, you could define a password there with heroku config:set NAME=rgsoc and heroku config:set PASSWORD=secret and then  change the authentication on your controller to http_basic_authenticate_with name: ENV[’NAME’], password: ENV[‘PASSWORD’], except: :index if Rails.env.production?
  • repetition on how to use the ternary operator. Good thing for refactoring. It's the same as if ... else ... end. This is how it looks like:  condition ? true : false
  • learned the last remaining Ruby keywords on our list: redo and not. Redo does the same action again. It's basically only useful when the output differs on repeating the action, e.g. when you create a random number. Not is the same as ! but the ! is safer to use. Just believe us.
  • and last but not least we repeated all the keywords we've learned during the past almost 3 months. Somehow the lesson shortly drifted off to the fact that the Bible implies that PI is 3. Which led Erik to the conclusion: "Maybe God is just okay with rounding."

Picture
Above: we found out you can call .to_blob on an image in Gosu. It'll give you a string of all the pixels.
Picture
Now you can choose your favourite pixel, find it in the string and .... well .... EASILY test if an image is flipped correctly when the pixel in the string of the unflipped version is in its mirrored position. Yeah....
0 Comments

Block Party

22/9/2014

1 Comment

 
Blocks
  • a block looks like this:  { |x| x …some stuff ...}
  • every Ruby method accepts a block (just one though), but It has to be the last argument in the parameters. Ruby knows it’s a block if you put the & in front of it: def foo(&block)
  • there's a special method called block_given? which tells you if a block has been passed

Procs
  • a proc is a block which can be stored in a variable and thus be reused
  • you can always turn a symbol into a proc that calls itself on the argument by doing p = :symbol.to_proc and use the proc by saying (&p)
  • create your own Proc with p  = Proc.new { |x| ……some stuff …..} or p = proc { ……. } 
Picture
Lambda
  • is pretty similar to a proc
  • is created like this: l  = lambda { |x| ……some stuff …..}

Difference between proc and lambda
When a lambda returns, it passes control back to the calling method; when a proc returns, it does so immediately,  ignoring the rest of the method.

Yield
  • is the same thing like block.call but it is over 5 times faster!!! (remember Erik's slides!). It’s giving over control to the block.
Picture
1 Comment

uninteresting title (NoTitleError)

19/9/2014

0 Comments

 
Picture
  • Erik introduced us to exercism.io, a page where you can solve riddles, submit your code and have it reviewed by other people.
  • had a look at Heroku and played around a bit with deploying an application there. Exciting!
  • ticked off another word on our keyword list: self. Use it if you want to define a method on the class itself by typing def self.method_name. You can also use self inside an instance method if you want to refer to the instance.
  • prepend: similar to include, but inserts the module one class below in the ancestor hierarchy. This comes in handy when you want to use super and want to refer to another module.
  • talked a bit about Minitests. Whereas RSpec uses domain specific language. e.g. it …. should, expect(something), …. Minitest assumes you know Ruby and the way you define tests is by defining a class and methods for this class. The methods begin with test_ and whatever comes after the _ equals is the "it should”.
  • with Klaus we refactored some more our game using delegation (lamps and genies now have their own draw method and the know wether they are flipped and good or evil).
  • Today Lisa from the Rails Girls Berlin chapter stopped by our office and showed us all the games she already made using JavaScript and Lua. Cool stuff! Also she encouraged us to go and visit hackathons and crypto parties. Will do :) 

0 Comments

Super and Spaceships

17/9/2014

0 Comments

 
We'll now try to make up for being lazy, just taking pictures and not writing down all the new stuff we learned!
So here we go... 

  • because the term "documentation" is all over the place, we desperately wanted to know what it is. We understood it's basically a description of how the code works and always depends on who wants to know about it. If it's for another developer, the documentation is most likely in the readme.md file, describing how to set up the program, start it, test it and so on. To check if your readme file is still up to date with your code, you might wanna use the gem ataru, which was created by our fellow Rails Girls, the CodePadawans. Sometimes people use source code documentation to describe what their public methods are doing - WHICH IS BAD! - use it only for code that gets used by other programmers (e.g. if you created an API) and NEVER use it to make the code more understandable ... refactoring should do this for you. 
  • REST(ful) is another concept which seems to be quite trendy. You're doing a good job at being RESTful if you're using the HTTP verbs in your application, that is, the right verbs for the right actions. Don't use POST all the time, that could be very dangerous!
  • super is nice. When used in a method, it goes up the hierarchy of ancestors of its class and kind of replaces super with whatever is defined in that superclass method.
  • we briefly touched the highly important topic of rails environments. There are three by default (test, development and production) but you can also define your own environments, like e.g. staging. In the Gemfile you'd do something like
    group :test do
    gem ‘rspec’
    end
  • Spaceship method! Looks like this: x <=> y 
    It will return -1 if x is less than y, 0 if they’re equal, an 1 if x is more than y. In order to make use of it you need to include the module Comparable and define the spaceship operator. It's useful when you'd like to  order objects in your class.
  • quickly talked about the gems better error and airbrake. Better error is a gem for rack apps which shows  more information about an error, prettily displayed in your web browser. It's used in development. Airbrake on the other hand shows a nice error page to the end user and informs the developer about the incident. It's used in production. 

The final two weeks of our Summer of Code are running and we have a compatible curriculum for them. Still 10 Ruby keywords left, 10 terms on our "want to know about this"-list and 8 issues in our carpet diem game! Thanks to Barcelona we're ready to go for this final spurt! Hopefully we'll be so busy, we won't have time to be sad about the nearing end.


0 Comments

BaRuCo

15/9/2014

0 Comments

 
Picture
Picture
Thursday 9/11 was the Catalunian National Holiday. They held a demonstration with 1.8 million people demanding independence from Spain.
Half of the conference seemed to consist of the Berlin Ruby posse :D
Picture
Picture
Creatures of the sea: in the aquarium and on our plate!
Picture
Picture
Heroic!
We take it you missed us! Here is a summary of our stay in Barcelona:
  • obviously we enjoyed the city: sun & beach & great food
  • BaRuCo: fancy venue hosting cool talks, e.g. by Erik on Writing fast Ruby and José's first appearance on Twitch-Plays-Pokémon, also Emily Stolfo's talk Release Responsibly
  • yes, we met and even shook hands with Yukihiro Matsumoto aka Matz. And of course we met many really nice Rubyists
Thanks everyone from BaRuCo for having us, we had a BLAST!

Picture
FC Barcelona vs. Athletic Bilbao! So great! Thanks thanks thanks!!!
Picture
Erik and Yukihiro Matsumoto!
Picture
Obviously there is a spelling mistake!
Picture
Excitement during duty free shopping....
0 Comments

Never do unnecessary work

8/9/2014

0 Comments

 
On Friday we visited the Music Hack Day, which Erik was MCing. Surrounded by about 200 creative techies and music company people, we primarily enjoyed the atmosphere and continued composing sounds for our game.
We even made it into DIE WELT - have a look at the article! Can you find us in the picture?

Today we optimized the performance of the collision detection. The previous code made the game reeeaaaaalllly slow. Erik used this opportunity to introduce his principle "Never do unnecessary work". This basically means that you should refactor in a way that your code is A) short and B) it only computes values it really needs.
 In order to see the performance difference we used a fancy gem called ruby-prof. It shows you how long each call takes and how often it gets called while the program runs. You can display the output as html (ruby-prof game.rb --printer=graph_html > prof.html) or with graphviz, which visualizes nodes and edges, i.e. the relation between objects  (ruby-prof game.rb --printer=dot > prof.dot).
Another tool to measure the time performance of your  code is Benchmark. As opposed to ruby-prof, Benchmarks tests your code under laboratory conditions.
Picture
Picture
Cool, huh?


You probably won't hear from us for the rest of the week because we're going to BaRuCo in Barcelona!! Yeah! :)
0 Comments

The sound of music

4/9/2014

0 Comments

 
Picture
Forgot to mention: yesterday we had a good laugh looking at commit messages of other people. Have a look at commitlogsfromlastnight.com and whatthecommit.com. Hilarious!

Adjusting to our SoundCloud surroundings, we played around with SOUND today, using the brand new Sonic Pi! Sonic Pi is a programming environment for Macs and Raspberry Pi based on Ruby, with which you can create music / sound .   Our game still desperately needs some sound (background music, collisions with lamps and genies...), so Erik showed us this fancy way to simply code our own music! 

We could just as good rename our "Summer of Code" into "Summer of Fun", which indeed it is! :D


0 Comments

Interface vs. gerbil

3/9/2014

0 Comments

 
Picture
In order to get our collision detection going, we needed a gem called texplay. In the discussion in which file to require it, we touched the term interface. It's basically everything the user / coder interacts with, without needing to know how it works under the surface, i.e. without being bothered with implementation details. Erik pulled up a good example by comparing it to a car. In a car, the steering wheel, the pedals and the clutch are the driver's interface. The driver only interacts with those and doesn't care about how the car actually works ("there might be a gerbil running and when the car is not working any more, the gerbil is probably dead and needs to be replaced"). 

While writing some more tests and methods, we stumbled upon .flatten (also .flat_map, if you want to combine it with .map). It's a method for arrays, that reduces one level of brackets.

Erik took us with him on a notional journey to the olden days, when we were still in school, learning about Mengenlehre / set theory. Who would have believed that those theories would be of use some day?! Now it helped us to understand how we can find overlapping pixels in two images, i.e. the same elements in two arrays.




Picture
0 Comments
<<Previous

    Rails Girls Summer of Code 2014

    Ready for an adventurous journey through the universe of code? We sure are!
    Follow our first steps - stay tuned!

    RSS Feed

    Archives

    September 2014
    August 2014
    July 2014


Powered by Create your own unique website with customizable templates.