Skip to content
This repository was archived by the owner on Dec 31, 2019. It is now read-only.

Tutorial

brianmaissy edited this page Dec 12, 2011 · 2 revisions

Things we should learn during the tutorial phase:

Everyone, learn ruby (not necessarily for the tutorial):

Cat - Javascript, Ajax

I did tutorials for Javascript, debugging Javascript with Firebug, JQuery, and Ajax for Ruby on Rails. The provided tutorial for Javascript (the first one, the language tutorial) started out at too high a level for me, so I went and did the W3Schools Javascript tutorial first (http://www.w3schools.com/js/default.asp) and then came back to the other tutorial. I found a tutorial for AJAX for Ruby on Rails at http://onlamp.com/pub/a/onlamp/2005/06/09/rails_ajax.html.

From the The W3Schools Javascript tutorial, I learned that basic things like semicolon use and arithmetic and equality operators and so on are pretty much like in Java and C, nothing super shocking there. The most helpful things I got from the tutorial were how to put buttons on a web page, how to put forms on a page, making events happen when buttons are clicked, focus is lost, etc., how to make a text box for user input, how to make use of that input, and how the HTML DOM works. Since our project is a website that will have loads of interactivity, all of these things are very necessary for the site. The ejohn.org tutorial was very useful in helping me understand how functions and objects work in Javascript, which I foresee coming in handy for the more complicated user interactions on the site. Although this tutorial was much more in-depth than the W3Schools one and definitely covered more powerful parts of Javscript, right now I find the W3Schools one more relevant because I only have a very simple notion of how the site will work, so it's easy for me to think of where I might need obvious things like text boxes and buttons, but since our team hasn't decided on our design yet it's more difficult for me to imagine what objects and functions I'll need.

The Firebug tutorial got me set up to do debugging in Firefox and was reassuring since it showed me that the basics of Firebug debugging are much like the Eclipse debugging that I am used to and comfortable with. The JQuery tutorial on drag-and-drop was awesome; I can really see us using drag-and-drop in the site, like perhaps the workshift manager could drag and drop residents' names into shift slots, or something like that anyway. The Ajax tutorial was very helpful in introducing several ways to make user input both update the data on the backend and change the corresponding parts of the display on the page without refreshing the page, which is something we'll want to do a lot of, such as when workshift managers assign shifts, or when residents sign off of shifts or set their shift preferences. A small but nice thing that I found out that Ajax provides is the ability to display the status of a file upload, which would only be used infrequently and in one place (the beginning of semester house roster file upload), but would be a nice little extra feature to implement if we end up having the time at the end.

Brian - testing with rails, job scheduling, twitter integration

Testing with rails

  • I used the tutorial comprising Chapter 13 of Agile Web Development with Rails to learn how to do testing with Rails (I have already done the rest of the tutorial in the past).
  • Testing is Rails is easy, because a testing framework is built right into the scaffolding created when you create a new project. Rails is designed for agile development, which stresses a test-driven development cycle with rapid iterations. This agility will be useful when creating the WSMA, because it will allow us to show something to our users as soon as possible, and to involve them in the development process. Even before writing code, we should write ruby tests which represent acceptance tests given during the specification phase of development. They allow effective testing of the model validation and business logic without needing to work through the views, as one would during manual testing.
  • Fixtures can be used to simulate existing database state when running tests.
  • The testing framework can simulate http requests and inspect the response. Selectors are a complex language which can be used to inspect and perform tests on the html content of the responses. Integration tests can test an entire user story step by step, tracing an interaction across multiple requests to different controllers.

Job scheduling

  • I learned that it is feasible, and in fact easy, to schedule jobs for the server to execute outside of the client-request/server-response pattern. After researching for tools to do so, I found rufus-scheduler (https://github.com/jmettraux/rufus-scheduler), a very lightweight library to accomplish this task. Other tools are more complex than we require, and it is not easy to manage scheduled tasks with cron alone, so rufus, scheduler seems like the right choice.
  • I spent some time reading the documentation, and found that we can dynamically schedule arbitrary jobs and cancel scheduled jobs. These will be useful to automatically mark a workshift as blown off when a certain time passes. If a resident signs out of a shift, we will need to cancel the job. When scheduling, rufus-scheduler returns a job object, whose job_id we can take out and put in a database of scheduled jobs. We can then look up this id later and cancel it based on that parameter. We probably won't need to use anything more complicated than this one-time scheduling.
  • Rufus-scheduler allows the use of 'schedulables', so we can encapsulate some of the logic instead of passing it all around in blocks.
  • Since we are not going to be scheduling jobs which run with high frequency or time precision, we can turn down the scheduler's frequency to lower the amount of resources it will use.
  • Time strings are passed to rufus-scheduler in a variety of formats. Some processing of time strings may be necessary to convert from the format our database or rails application is using, but this should not be too difficult.

Twitter integration

  • The old system shows the most recent tweets from @BSCAnnounce on each user's home page. This twitter account posts announcements relevant to the BSC residents. We want to make sure we migrate this functionality to the new system.
  • After doing some research into the available Twitter APIs and how it was done in the old system, I found a very simple way to list the most recent tweets from a given account on a web page. Twitter has a basic widget maker (http://twitter.com/about/resources/widgets), which produces a very simple javascript snippet which can be added to any web page. This gives the desired functionality without going into the more powerful but complicated Twitter REST or streaming APIs.

Tai - Ruby, Ruby on Rails, a lil taste of Javascript

I did my tutorials on Ruby, Ruby on Rails, and a little bit of Javascript. While it wasn't necessary to learn Ruby before Ruby on Rails, it was suggested that knowing a bit of Ruby would help in understanding other components of the project. I found that the ruby syntax was not very hard to pick up, as I found it similar to python. There were new concepts, such as symbols, that I haven't seen before. I didn't spend much time on this tutorial though as I wanted to spend most of my time learning about Ruby on Rails. I know that if I need to look up any kind of Ruby syntax that I don't understand I can quickly go back to the tutorial at http://rubykoans.com/ .

This was the first time I've been exposed to Rails. I learned how to start and run a simple Rails project on my laptop. I went through the basics of first how to install rails on my machine, which took a couple of hours to set up due to some mistakes on my part. I learned how to have Rails generate a lot of the scaffolding for a simple web app, along with how to customize the auto-generated project files to better suit our projects needs. Learning how to make rails set up and communicate with a server was one of the most important points I got out of the tutorial. It's amazing that with a few quick commands Rails will generate a custom database that can be furthur customized with our own logic and constraints. I also liked that Rails has development and production environments for doing different kinds of tests, and that different servers will start based on the environment. Another important function is associating models. We'll probably have a model for Students and a model for Chores, and associating these two models is something I'm sure we are going to do.

I also looked a little bit at the Javascript tutorial. I found the provided tutorial interesting, but it doesn't really illustrate what we'll be doing with javascript for our project. I did look for tutorials for drag and drop, and there were plenty of tutorials on this subject. Most had the javascript for how to do drag and drop, along with examples that I was able to play around with. These were very useful, and definitely something we can use to integrate with our project.

Travis - Ruby on Rails

I did the tutorials on Ruby on Rails and I'll dig deep into it if I have time. After the tutorial, I learned how to generate simple web apps through scaffolding. It didn't occur to me that actually ruby on rails comes with lots of powerful features on things such as creating a post, deleting a post, as well as asking the user for passwords. I didn't know Ruby before and it seemed that Ruby was a language easy to learn, at least I understood the ruby code completely. I ran into some problems with the version of gem/rake I'm using. But I managed to find solutions online (internet is soooo powerful!). Now I'm able to create simple pages. I will spend more time on this and understand it more skillfully. Now I'm just very curious about how to interact different servers, languages together.