This project was first created sometime in mid 2014. I think. A two part series on the overview and then the implementation with code snippets. Coderzhub, is a website dedicated to bringing coders of all skills together to code and to further the progress of a project.
The entire code of the project, Coderzhub can be found at https://github.com/antonioperez/codershub.
Site: http://coderhub-aperez.rhcloud.com/
A user, with a valid email address, is able to import multiple projects from a GitHub repository upon registration. A project page is created that displays the project’s description, owner, and initial settings. The initial settings on the project can help other users find the project, for example, by setting of ‘buggy’ the owner can notify the sites users that the project has full of bugs and so called bug hunters may (hopefully) see the project as a challenge.
Other options are available for others who may want to partake in a project on a different stage of development. ‘Initial’ is an option where the project may have little code and with a lot of room to discuss design across the board. A status of ‘Complete’ tells users the project is in a refinement stage where algorithms can be optimized or improved. A status of ‘Help’ can be an urgent call from the project owner to recruit more developers. Upon creating a project instance, a private forum that can only be accessed by subscribers of that particular project or assigned owners of that project can view that particular forum.
In a private forum, users with permission can create topics for discussion with a What You See Is What You Get (WYSIWYG) editor. This allows for users to easily post beautiful descriptions that are rendered as pure HTML. Within a topic, a tree style comment section is what allows the users to communicate. The people who comment on a topic first create a thread and any replies are added and displayed underneath that parent comment. This allows a constant stream of comments discussing one particular issue that the parent comment addressed. This is different from the Facebook style of comments where comments are only displayed linearly and sorted by time, and discussion is hard to follow. Topics can be voted on to increase their popularity. The more popular they are, the higher they will appear to the user.
Private forums are not the only way for users to interact with each other; a messaging system is in place that allows users to privately send messages to any registered user. This messaging system also allows for a WYSIWYG editor to be used when composing a new message or reply. An inbox, sent messages, trashed messages are also options to the users. Profiles are the doorway to many of the projects and users. In a user profile, a list of repos, or projects that they own is displayed by time of creation. The user’s email, GitHub link, and personal information they want to display are viewable in the profile. An activity stream enables other users to see what that particular has been up to is also viewable. For instance, the last time that user commented or imported a project.
Forums are not exclusively private, but also has a section open to all users. Anyone can create a new forum, such as ‘Python’, where users will expect different specialized topics on that forum. Public forums can allow users to question or answer problems based on specific programming languages or perhaps in more general place like design. The users create the forums and essentially their own community.
Topics, Forums, Users, Projects have to be able to easily searched to make the users feel connected, so the search functions are split into different sections rather than having everything displayed by a single query. For example, a user can search by project status, project name, by language of project or topic, and by username.
Implementation
Coderzhub is created in Python 2.7 with the Django 1.6.1 framework with a Mysql 5.6 database storing the data. The central component of MVC, the model, notifies its associated views and controllers when there has been a change in a state, and the model directly manages the data, logic and rules of the application. A view requests information from the model that it uses to generate an output representation to the user. A controller can send commands to the model to update the model’s state. It can also send commands to its associated view to change the view’s presentation of the model.
In Django, the project directory structure represents the MVC pattern clearly. A Django project consists of apps that split and organize the files. The projects folder and the users folder have the main code that handles the user generated data and business logic. There is a main templates folder that holds view files, which are HTML files that are used across the site. This allows the developer to avoid unnecessary repetition of code if one can just include or import that HTML code. Within an application folder, a developer can define the view files in a template folder, the models.py can be used to define the database tables and relations, and the views.py is where the main business code to handle database calls or business logic.
The database has many relations that allow the site to function properly. There are many one-to-one relations between the projects table and it’s children connected to the main user table. The Django framework creates a basic user table with permissions as default, so to expand it for the use case of allowing GitHub projects to be imported. A table with a one-to-one relation had to be linked. Through these links, it is easy to access other instances instead of having to make multiple queries. The following is a total Enhanced entity–relationship (EER) model of the database.