Review GSoC Proposal for KDE Reports

Yash Ladia ladiayash at gmail.com
Tue Mar 18 19:35:56 UTC 2014


Hello Everyone,

Below is my project proposal for KDE Reports. I have submitted it on google
melange. I would be grateful for any feedback.


Thank-you,

Yash.


Name: Yash Ladia

Email Address: yashladia1 at gmail.com

Freenode IRC Nick: yash93

IM Service and Username: xmpp-google: yashladia1 at gmail.com

Location (City, Country and/or Time Zone): Kolkata, India GMT+5.30

Proposal Title: KDE Reports backend code upgrade

Motivation for Proposal and Overview:

The KDE Reports page still uses Rails 3.2. Though it gets the job done, it
is high time we updated to a newer version of rails. Though we not in dire
need of any feature specifically, it is always nice to have the latest
framework. Rails 4 has been around since almost a year. The latest stable
release is Rails 4.3. Rails 4 has many new features. Few of them that might
be helpful for the site in the future:

   1.

   Live Streaming- Allowing data from different activities to be streamed
   to the browser without reloading the page.
   2.

   Rails 4 allows you to set controller-wide ETag suffixes, which is
   extremely useful when an action depends on an authenticated user.
   3.

   Many more security features and fixes.

But before we can upgrade we have a hiccup. The testing of the reports page
repository is quite incomplete. 16 tests are yet to be written. In order
that we can upgrade without breaking anything, now or in the future, it is
practically mandatory that we have a nice complete set of integration
tests. Also, the tests are written all together, i.e. all the tests for all
activities (currently only projects and news) are in one large module. This
makes code hard to read and hard to maintain. Future changes would be
cumbersome to make. I want to clean up this code; split it into different
files, one for each activity. There are some feature of the rspec testing
framework that helps with creating more generic tests for different tests
that are similar. I will make use of this feature.

Also, the newly made reports.kde.org site does not display news at all. The
site currently has only project reports being displayed, which on its own
functions as it should: The "Latest Projects" activity shows up to 5
entries in the homepage and an entire list when the tab is opened (either
from the bottom tab browser, or the heading in each rectangular box). Each
entry contains a title (that is a hyperlink to the full thing), followed by
a 2-3 lines description. The news activity, however, only has a frontend
but no way of fetching data in the backend. I could write the news activity
backend just as the projects activity but the code similarities between the
projects activity and the news activity will be immense. Moreover, as more
activities are added (in the future) their code would be same too. It would
be much better to create a modular and somewhat polymorphic code structure.
It would also avoid code duplication. I will create a generic code
structure for every activity. Every existing activity and the ones that
will be added in the future will be based on this and inherit from it. Then
I will write the news activity according to the code structure I created.

Implementation Details

During the coding period I perform the following tasks (listed
chronologically):

   -

   Modularizing tests: The reports page uses: rspec-rails, capybara (for
   simulating user), guard-rspec (for listening to file changes and running
   the tests automatically in the background), and factory_girl_rails (for
   generating the user data required for tests). All the testing related code
   is contained in the spec directory. Tests for all activities are now
   present in "spec/requests/reports_spec.rb" . As we will introduce new
   activities code in this file will go on increasing. The grouping is done
   according to "activity" and then sub-grouped into "application state".
   However, rather than grouping 'describe' individually into "Manage
   projects" and "Manage news", there is a common description "Manage projects
   and groups". I will change this: I will create a 'describe' for every
   activity in on the reports website. It will be beneficial to club the
   activities in a more generic way and apply them to each activity that is
   present and that will be added in the future. I will do this by creating a
   rspec file for every activity like "<activity>_spec.rb". Thus we need to
   modularize and reuse the code. I will do it by using shared_examples
   feature of Rspec. For example, a super editor will have most of the
   features of an editor. So instead of repeating the code, I will create a
   shared_example of an editor and will reuse the code in super editor(using
   "it_behaves_like" helper). Just like I did in my review
request[1]<https://git.reviewboard.kde.org/r/116810/>
   .
   -

   Completing the test suite: The reports page has some tests written for
   it. But before we can upgrade I will need to complete the test suite. There
   are still '16 pending tests' in "spec/models/project_spec.rb". I will write
   these and then move on to creating similar model test suite for news.


   -

   Upgrading to rails 4: Now that we would have our test suite complete we
   can begin upgrading from rails 3.2 to rails 4.0, according to the official
   rails guide[2]<http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0>.
   The guide itself is very detailed and covers everything including:
   introduction of HTTP PATCH, Gemfile changes, vendor/plugins changes, Active
   Record, Active Resource, Active Model, Action Pack, Active Support, Helpers
   Loading Order, Active Record Observer and Action Controller Sweeper
   changes, and some deprecations in sprockets-rails and sass-rails. I will
   upgrade ruby to 1.9.3 as it is required for rails 4. Just following guide,
   though will take about a week, will be sufficient. I checked the gems we
   are using and most are compatible with rails 4.0 except for cancan. But
   with this reference[3]<http://stackoverflow.com/questions/17242116/rails-4-with-cancan-unknown-attribute-error-after-including-load-and-authorize>,
   I will be able to complete the process. For some gems documentation is not
   available whether they are compatible with rails 4 or not. They are:
   charlock_holmes_bundle_icu and rufus-scheduler. For these I will have to
   make sure than a bundle install succeeds and the integration test do not
   fail. Otherwise I will have to workaround their issues or, in the worst
   case, use another gem.


   -

   Creating a generic code for all activities: The project activity code
   works as follows: project data is fetched in the backend by parsing the
   "kde_projects.xml" file[4] <https://projects.kde.org/kde_projects.xml>.
   Nokogiri gem is being used to parse the xml. By parsing the different
   components project objects are created and then stored in the database. A
   project object has title, description, git_repos,
   bugzilla_products,irc_channels, mailing_lists and so on, and these are
   parsed from the xml. This is then displayed on the website by simply
   querying the Project model in the controller. The query returns an
   array(@projects).Then simply looping through this the project reports are
   displayed. The basic abstract idea behind this (fetching, parsing the xml,
   the project object, the querying, and displaying) will be the same for the
   report of every activity. Hence, I will make a generic code for this. I
   will use models (and not classes). I will create a base module
   "activity". This would be implemented by all activities (both that exist
   now and the ones that will be added in the future). I chose module over
   class, as different activities may have some differences in their tables
   which would lead to denormalization in case of
classes[5]<http://stackoverflow.com/questions/1709257/refactoring-activerecord-models-with-a-base-class-versus-a-base-module?rq=1>.
   More than porting the code to the generic format, I will split the code
   into two parts: one will go into the generic part and another will go into
   project activity part. This would be better than writing one part of code
   first and then making changes to the first one while writing the second one.
   -

   If time permits, I will do the same in the news activity. In case of
   news, data has not been fetched in the backend. There is a rss feed in case
   of news. So by parsing
"news.kde.org/rss.xml"[6]<https://news.kde.org/rss.xml>in a similar
fashion I will create a News object and then store it in
   database. I will try not to hard to code it but if I am very short on time
   I may have to go with this and mention it as a '#TODO' comment that we need
   to change this as soon as possible. Tests have already been written (and
   completed) for the news activity so development will be faster than writing
   code for a new activity from scratch.


Tentative Timeline:

May-

<--- GSoC commences--->

week 4: Modularize the existing tests.

June-

week 1: Complete the test suite.

week 2: Upgrade to rails 4.0

week 3: Fixing bugs while updating ruby or rails.

<--- Mid term --->

week 4: Workaround the incompatible gems.

July-

week 1: Make sure all the integration tests pass.

week 2: Start creating a generic framework for activities.

week 3: Finish creating a generic framework for activities.

week 4: Test the projects activity. Fix tests if they fail otherwise start
working on the news activity.

August-

week 1: Work on news activity: make sure all tests pass.

<--- suggested "pens down" --->

week 2: Do code cleaning, documentation.

<--- firm "pens down" --->

week 3: Prepare and submit reports

Other Obligations: I am free to code up to 50 hours a week. I have summer
vacations from May to mid-July. But even after college session starts, I
can continue to code with a similar schedule as course load is very less in
the beginning of the semester and teachers do excuse GSoC students from
classes.

About me: I am a third year undergraduate student in National Institute of
Technology, Durgapur pursuing a B.Tech in Computer Science Engineering.

I have coding experience in Ruby On Rails, SQL, CSS, Javascript, CSS/SASS
and Jquery. I have worked in
Flixstreet[7]<http://en.wikipedia.org/wiki/LRC_(file_format)>which is
also built on Rails framework. I (along with one more partner) am
making my own social website: 67street[8] <http://www.67street.in/>, also
based on Rails.

I have recently discovered my love for open source, especially KDE. I have
submitted two patches for review in
Amarok[9]<http://en.wikipedia.org/wiki/LRC_(file_format)>
[10] <https://git.reviewboard.kde.org/r/116641/>. Since I am new to Qt, I
was glad to find that KDE websites are written in rails which is my area of
experience. I am sure that working remotely with a mentor won't be a
problem to me. My mentor can checkout my code from my personal scratch
repository.

After my GSoC project is complete, I want to become an active developer for
KDE Reports. The website is still in its infancy and there is a lot that
can be done to it. I want to write new ideas for in GSoC 2015 for
reports.kde.org and mentor students for those ideas.

External links:

[1] https://git.reviewboard.kde.org/r/116810/

[2]
http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0

[3]
http://stackoverflow.com/questions/17242116/rails-4-with-cancan-unknown-attribute-error-after-including-load-and-authorize

[4] https://projects.kde.org/kde_projects.xml

[5]
http://stackoverflow.com/questions/1709257/refactoring-activerecord-models-with-a-base-class-versus-a-base-module?rq=1

[6] https://news.kde.org/rss.xml

[7] http://www.flixstreet.in/

[8] http://www.67street.in/

[9] https://git.reviewboard.kde.org/r/116741/

[10] https://git.reviewboard.kde.org/r/116641/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kde-www/attachments/20140319/ab547b2d/attachment-0001.html>


More information about the kde-www mailing list