A Report of a Specialty Practice at Tallinn University of Technology

It was decided to perform a practice this spring semester. The general aim of a practice is to develop specialty skills, to get experience in some engineering field, to fix knowledge.

The aim of a given specialty practice is to propose a new algorithm model for the single, unified sequential rating. A given report is written in order of an introduction, a process for development of a proposal, a demonstration of an old algorithm model of existing ratings, a proposal of a new algorithm model of the rating and a conclusion being turned to.

Introduction

The section of news of the sintjurin.ee website exists starting from the 2005 year. In the 2007 year this section has been remade and the rating of news has been created as a result of a diploma being written on the first level of higher education. It was an initial version at that moment, which was immediately accessible as a ready-made section in a web. That version has included an algorithm model of calculating of ratings, which remains to be the same for present only a bit optimized.

Initially, this algorithm model had not been brought separately as standing alone functionality. Therefore, full ratings of existing objects were always synchronously calculated on a response (to a GET-request of the HTTP protocol) when the section was accessed or visited by a user. As a consequence, a response of a server was not immediate to every request because of significant time being needed to calculate full ratings.

In the end of the 2007 year, this algorithm model has been brought separately as standing alone functionality. By now, it is asynchronously executed with the interval of every 3 minutes. Sequential positions of ratings are recorded into separate columns of a database. After that, the functionality is coherently optimized removing unnecessary parts, modifying old and required parts. In the middle of the 2008 year, it is optimized in a way as its most common and very obviously identically everywhere multiplied content is brought to a separate part of it.

The process of development of a new algorithm model of the rating

Although optimization of the functionality is further continued, there are no remarkable modifications of separate ratings. Each of them utilizes practically the same model being developed with its own full programming code separately from others. For further development, the aim of a given specialty practice consists of the following necessary tasks or coherent steps being performed.

  1. All those files with a code of asynchronous functionality of an old existing algorithm model have been selected and brought together to one place.
  2. Unnecessary and needless code lines have been removed from contents of those files.
  3. All the code in those files has been rewritten utilizing English for a pseudo-code.
  4. After that, a brainstorm for a new algorithm model has been begun.
  5. Initially, the algorithm model of the separate rating of news has been investigated as it is the main object of the section. In accordance to this model, the following remarks are made: firstly, news has its own temporal actuality; secondly, news has a comment as its constituent; thirdly, a user gives a vote for or against news.
  6. When the algorithm model of the separate rating of comments has been observed, the same remarks are made except that a comment has news as its constituent.
  7. When the algorithm model of the separate rating of users has been also observed, the same remarks are made except that a user has experience as temporal actuality, has news and a comment as constituents which are added by himself.
  8. As a consequence, in accordance to all those remarks, which are made in every model of separate ratings, a precise structure and its certain parts are emphasized. The first part is for temporal actuality, the second part is for constituents and the third part is for received votes from users.
  9. Obviously, each separate rating of an object has copies of another object as its constituent. While such a separate rating is calculated and there is a need to calculate a rating of a constituent, it is logical to utilize an appropriate centralized object in the rating rather than realized copies in the same code of a separate rating.
  10. As a result, a common pattern has been composed for a realization of every single object for which participation is needed in the rating. Additionally for each of those ratings being separate previously, such a pattern has been realized utilizing English for a pseudo-code of what functionality has to be existing based on previously developed and new needed ones.

An old algorithm model of existing ratings

Fundamentally, an old algorithm model of existing ratings is based on the following principle. News have been thought of as the main object in the section. If news is added, a possibility must be present not only to give a vote for or against it, but also to express a point of view adding a comment. As a consequence, while a rating of news is calculated, it is also necessary to calculate a rating of a comment as a constituent of news. If a rating of such a comment is influenced by giving a vote for or against it, a separate rating of the second object is originated. Because of a comment being only added to news, a rating of such a comment is also influenced by a rating of news as a constituent of a comment. Finally, news as well as a comment is added by a user and consequently a separate rating of the next object is originated. A rating of a user is influenced by a received vote for or against him and also by news and a comment being added by himself as constituents of this object.

With the principle in mind, the following three separate ratings are present: news, comments and users. Each of these is separately from others with its own full programming code. In the event of necessity to consider a domain from which news is added, news will be additionally influenced by a rating of a domain and consequently the additional object will be originated. For this reason, it will be necessary to maintain an additional separate rating of domains as well as other separate ratings. It will be necessary to consider all those other separate ratings which can have a domain as a constituent. It will be a need to modify and improve each of those ratings separately because of it being not centralized, not a single and consistent rating. For an example of an old algorithm model, the pseudo-code of the separate rating model of news is demonstrated below.

class my_common {
/* A function my_common() initializes required data. */
function my_common() {}
/* A function get_user_rating() calculates a rating of all users, considering for each separate user to determine the amount of addition of simple average values of every user which has given a vote for or against this separate user. A simple average value is an average between (1) the relation of registration time of a user to present time, (2) a rating of news of a user and (3) a rating of comments of a user. */
function get_user_rating() {}
/* A function get_user_news_points_1() calculates a simple average of a rating between all news being added by a user, considering for each separate news to determine a simple average between (1) the relation of addition time of news to present time, (2) a rating of comments of news and (3) every vote being given for or against news. Every vote is the relation of addition time of this vote to present time. */
function get_user_news_points_1() {}
/* A function get_user_news_com_points_1() calculates a simple average of a rating between all comments of news, considering for each separate comment to determine a simple average between (1) the relation of addition time of a comment to present time and (2) every vote being given for or against a comment. Every vote is the relation of addition time of this vote to present time. */
function get_user_news_com_points_1() {}
/* A function get_user_coms_points_1() calculates a simple average of a rating between all comments being added by a user, considering for each separate comment to determine a simple average between (1) the relation of addition time of a comment to present time, (2) a rating of news of a comment and (3) every vote being given for or against a comment. Every vote is the relation of addition time of this vote to present time. */
function get_user_coms_points_1() {}
/* A function get_user_com_news_points_1() calculates a simple average of news of a comment, considering for this news to determine a simple average between (1) the relation of addition time of news to present time and (2) every vote being given for or against news. Every vote is the relation of addition time of this vote to present time. */
function get_user_com_news_points_1() {}
}
class my_news {
/* A function my_news() initializes required data. */
function my_news() {}
/* A function get_news() calculates a rating of all news, considering for each separate news to determine the amount of addition of (1) the relation of addition time of news to present time, (2) a rating of comments of news and (3) simple average values of every vote being given for or against news. A simple average value is an average between (1) the relation of addition time of a vote to present time and (2) the relation of a rating of one user which has given a vote for or against news to the highest rating of the other user. */
function get_news() {}
/* A function get_news_com_points_1() calculates a simple average of a rating between all comments of news, considering for each separate comment to determine a simple average between (1) the relation of addition time of a comment to present time and (2) simple average values of every vote being given for or against a comment. A simple average value is an average between (1) the relation of addition time of a vote to present time and (2) the relation of a rating of one user which has given a vote for or against a comment to the highest rating of the other user. */
function get_news_com_points_1() {}
/* A function late_news() transforms an array of all news with rate data into an array in order of latest news. */
function late_news() {}
/* A function top_news() transforms an array in order of latest news with rate data into an array in order of top news according to rate data. */
function top_news() {}
}

Because a rating of a user is always considered when a vote has been given for or against, it is very obvious that such a content of the functionality is the most common and must be identically everywhere multiplied. It has been brought to a common separate part of the functionality as a result of coherent development and optimization.

Following the demonstration of an old algorithm model and observation of its functions in detail, it is definitely possible to emphasize the main parts as the premises for a new model.

  1. For the first part of a new model, it is easy to observe calculation of constituents of a separate rating. In this part, those individual exemplars dominate the rating of constituents of which is the highest. A constituent implies another existing object.
  2. The next obvious part of a new model is calculation of votes being given for or against individual exemplars. In this part, those exemplars dominate the difference between positive and negative received votes of which is positively the highest. The assumption is the possibility for users to give a vote for or against.
  3. The third part of a new model is the relation of addition or registration time of an individual exemplar to present time as temporal actuality. In this part, those exemplars dominate temporal actuality of which is the most actual. When an exemplar is added or registered then it must be of a more interest although at the moment it can have no sufficient rating of a constituent and no sufficient received votes for the purpose to compete with earlier added or registered individual exemplars.

For this reason, while a rating of a user is calculated, ratings of news and a comment of a user need to be calculated. While a rating of news is calculated, a rating of a comment of news needs to be calculated. While a rating of a comment is calculated, a rating of news of a comment needs to be calculated. Obviously, the part of it is repeated multiple times. Therefore, it is logical to utilize a rating of an object being centralized and to refer to that object everywhere in a code.

A proposal of a new algorithm model of the rating

Following the explanation of an old algorithm model, the main parts being emphasized for a new model, necessity to connect to one object another and participate with individual exemplars, the next proposal of a new algorithm model of the rating is made as a pattern for a realization.

class r_<object> {
/* A function r_<object>() initializes required data. */
function r_<object>() {}
/* A function get_<object>() calculates a rating part of individual exemplars of an object, considering for each separate individual exemplar to determine the amount of addition of returned results of (1) a function get_self(), (2) a function get_votes() and (3) a function get_possession(). */
function get_<object>() {}
/* A function get_self() calculates the relation of addition or registration time of an exemplar to present time. */
function get_self() {}
/* A function get_votes() calculates the amount of addition of values of every vote being given for or against an exemplar, considering for each separate vote to determine a simple average between (1) the relation of addition time of a vote to present time and (2) a rating of a user as a constituent individual exemplar of another object which has given a vote for or against an exemplar. */
function get_votes() {}
/* A function get_possession() calculates a simple average of a rating between all constituent individual exemplars of another object. */
function get_possession() {}
}

To explain in detail a realization of, the mentioned pattern consists of an abstract class which is utilized for any object with its individual exemplars to participate in the rating. For a primary example, the object of news is selected. In this event, the special name as a label (<object>) is replaced with a concrete name of a concrete object (news). The object has temporal actuality, a vote being given for or against and a constituent referring to another object. In order to realize the given abstract class, its special functions are completed with respect to guidelines for appropriate functionality and any interconnection between all objects. Moreover, each concrete realized pattern can have auxiliary functionality.

In this circumstance, various individual exemplars of various objects are very tight connected to one another. When individual exemplars of an object have only their own sequence separately from others, it is a separate rating of an object. However, when individual exemplars of all existing objects have a single, unified sequence, it is a single, unified rating of all participating objects. In this event, if an exemplar of an object is more popular than another exemplar of another object, it is thought of as the former has a higher rating than the letter, considering all those traits which each of them possesses.

Before a conclusion is turned to, it is worth to mention programming languages for a realization of a new algorithm model. Because an old algorithm model is already written in a particular programming language, a new model is also written in that language. A lot of opinions exist about every programming language concerning its possibilities for expressiveness, functionality, performance. Nevertheless, if a pattern of a new model is maintained in a pseudo-code for every required object, it will be possible later to utilize any other programming language with its subtleties. For the very initial realization of a new model, a lot of drawbacks are tolerated. At the start, it is not probably for a wide audience, but it can be alternatively observed as a ready-made solution. As for the exact outcome, a common description of a new algorithm model is possessed and it is certainly possible to compose a concrete documentation.

Conclusion

For a conclusion, the section of a rating remains to be systematically in progress following logically from one developed solution to another coherently next solution, deploying new and modifying old functionality. As for the proposal of a new algorithm model being made, a concrete way is assigned for development according to the requirement of a unique position of an individual exemplar of an object in the single, unified rating.

Absolutely, a realization of a new algorithm model is the smallest tip of the iceberg of what will be necessary to develop, to think of how various interconnected objects being archived, commented, deleted. Nevertheless, this realization is a significant step and it is definitely the core in the event of the section being named as a rating. Primarily, the necessity to observe the actual rating as the main feature is stressed what should be prominent when the section is utilized.

References

Tags: ,

Comments are closed.