Jun 29, 2013

GSoC Week 2 | Birthday Week

First things first. I got the FedEx package on Monday, which contained the card, a diary and a pen. It was great and definitely worth the wait! The first use of the money was to get an Amazon Kindle, something I wanted for a long time.

The week also included my birthday and I could afford to work less on that day owing to the fact that I had done a lot of work in the last fortnight.

The first two days of the week was utilized in cleaning up my previous code to get a balance between optimization and readability. Some of those updates can be seen in the discussion that I had with Alex in the pull request.

They actually included pretty trivial errors. Some of them included:
  • Using jQuery's $.each() rather than a for loop.
  • Add checks to make sure my code doesn't show JavaScript errors on parts where I use something like someArray[3].
  • Remove all hard coded variables in JS like $("#comment-" + someId).
  • Write less code. For example, use if (!something.length) rather than if (something.length === 0).
  • Use single line if statements.
Since we had done a lot of AJAXification already (>1.5k lines- enough for the first seven weeks of the proposal), we decided to do something else. For that, we moved on to some UI improvements.

The first task for me was naturally more JavaScript oriented. To make the search filter in the browse courses page dynamic. Again, it was theme dependent, so my changes would be reflected only on the default theme.

I added the filters first, which took me one day and then added an accessible Accordeon developed by Alex. As my search filters involved hiding and then showing parts of the Accordeon, it meant I had to re-initialize the Accordeon after every search to make sure everything looked perfect. For that, a small tweak was necessary, for which I have already sent a pull request.

Anyways, I am still to get a detailed code review on adding the Accordeon, which I am very eager.

Let me take the opportunity to explain the branches I have developed in my ATutor fork.
  • master: My master branch is a bit messed up because I sent my first pull request (still active) to ATutor from this branch. Unless that pull request is resolved, this branch would remain obsolete.
  • gsoc2013: It has updated code from ATutor and is clean. I send pull requests to this branch for code review. Acts as the pseudo master branch.
  • ajax_demo: All my ajax related work is here.
  • ui_browsecourses: The modifications in browse courses page is reflected in this branch.
  • gsoc_head: Has all updated and merged gsoc code.
Keeping a separate branch for each feature is a must, and the branch names should reflect the changes. After all, that is the very essence of git. As Alex says in his git slides,
If not, then maybe it is time to switch back to SVN. Why bother with GIT ?

Liked this post? Have any suggestions? Just let me know. Feel free to comment below!

0 responses:

Post a Comment