Heya, In order to evaluate your skills as a backend Web engineer, we would like you to take this short development assignment, at your own free time.
- Please provide
- working code.
- a brief design document explaining what you did.
- a link to a server where your code can be tested.
- Feel free to search the Web for inspiration, but please do not copy code from anywhere, keep it 100% yours.
- Use Python as your language of implementation. Micro Frameworks and utility libraries are allowed, but not a full blown MVC.
You are to design and implement the API and server side modules for a simplified twitter like social updates site, and a simple AJAX client for it. The application contains users; Each user can post short text messages, follow other users, and get a feed of the latest updates from the users he is following. You can also get a global feed for all the users.
- Implement an HTTP based (ReSTful in the loose sense of the
term) API that exposes the following calls (no need for
authentication, choose the format you like):
CreateUser(UserName)
PostMessage(UserId, MessageText)
Follow(FollowingUser, FollowedUser)
Unfollow(FollwingUser, UnfollowedUser)
GetFeed(ForUserId)
Note the aggregate feed of the users this user is following!GetGlobalFeed()
- Please create an ajax based HTML page for this API:
- Interface It should support getting the messages from the followed users per user Id, with real time updates, and the ability to post messages. You do not need to implement following/unfollowing. No styling required.
- Implementation Use of toolkits (jQuery, Zepto, bootstrap..) is fine, but no frameworks plz (Angular, Backbone..). No need for mobile adaption. Strive for efficiency and readability.
Good Luck! The Walla! Backend Engineering Team
- State “DONE” from “TODO” [2013-10-02 Wed 08:20]
This was the easy part.
Was suggested during the interview
- State “CANCELED” from “TODO” [2013-10-02 Wed 08:21]
I’ll be usingneo4j
, that’s decided.
I have some vague memories of it being problematic to install,
perhaps it required mysql-devel
package? Can setuptools
install RPM / DEB?
- State “DONE” from “TODO” [2013-10-02 Wed 08:21]
Yup.
Just for the sake of experiment? There are couple of videos to watch. If I can get it to run easily, I’d probably use that.
- State “CANCELED” from “TODO” [2013-10-04 Fri 19:08]
Using nginx, so no need for Apache modules
There is some controversy about WSGI
/ FSGI
/ mode_python
Need to make sure I’m not using some outdated / unsupported
library.
- State “DONE” from “TODO” [2013-10-04 Fri 19:09]
Welp, using it now.
This is most likely candidate for the GUI. Need to see what components are already there, and what’s missing (unlikely).
We’ll see what Stackoverflow has to say…- State “DONE” from “TODO” [2013-10-04 Fri 19:09]
Been okay so far.
See if the stupid thing still works. Maybe we shall do w/o it. There was some other package… Probably elpy or some such, maybe it makes sense to check it out.
- State “DONE” from “TODO” [2013-10-02 Wed 08:21]
Looks like it also can now display Org files markup, so no need to export to Markdown
Not today.
Now pages assume the user is inside session, but break wen it is not the case. Need to redirect to login, when not in session. It must be using some default value, different in different browsers. Must set it to something. This is to switch between own profile, personal feed, collective feed. Errors are reported from server, but not displayed in the client. We already have a way to populate the content, not much remains to be done. Again, we already have the content, just write the aggreate functions and be done with it.All instructions are given for Fedora Core 18, but should
be similar for Debian-like distributions. Substitute apt-get
for yum
where appropriate.
First, install nginx
server:
sudo yum install nginx
Next, download and set up neo4j
from: neo4j, follow
the installation instructions.
Stop (if started) nginx
server:
nginx -s stop
Start nginx
server with custom configuration file found
in nginx.conf by running:
nginx -c /path/to/nginx.conf
Run setup.py:
sudo python ./setup.py
Check that main.py has execute permission, if not do:
chmod +x ./main.py
Now you should be able to launch the Tornado server:
./main.py &
The site consists of the following pages:
This is where users log in or register.
This is the page where users read each other feeds, change their profile info, view their own feeds and write new articles.
This page displays the user’s profile (the currently logged in
user or the one given by the user_id
verb following next in the URI.
Users can also follow
and unfollow
the profile owner from this
page.
This is the page where users read single articles. Articles are
given by the article_id
verb following next in the URI.
Right now I’m thinking about making it into a nomic game. The basic idea would be that by posting users may, in general, score points. More so, if someone comments on their posts, or if they themselves comment. But it would be also possible to loose points due to bad posts or comments. Sort of karma, just like there is one on the StackExchange sites.
I’m definitely going with py2neo
, especially because it uses
tornado
. It’s not as efficient as SQL (at the moment), but who
cares?
Nodes
User#{ "id": int, "name": string, "password": string }
Post#{ "id": int, "text" : string, "score": int }
Comment#{ "id": int, "text" : string, "score": int}
This is basically a reduced version ofPost
.
Relations
$user \; \boldsymbol{Follows(privately)} \; user$ $user \; \boldsymbol{FollowedBy(privately)} \; user$ $post \; \boldsymbol{PostedBy(privately)} \; user$ - $user \; \boldsymbol{AuthorOf} \; post
$user \; \boldsymbol{Rates(points)} \; post$ $comment \; \boldsymbol{InResponseTo} \; comment$