[Open-source interview] Zhao Gogo, founder of iNews: A 36-hour PHP HackerNews

Source: Internet
Author: User
INews is an open-source simple community program designed to make it easy for developers to obtain a sharing website that is generally compatible with HackerNews and is more beautiful and can run across terminals (Responsive. Quick Start: Install: run the iNews program configuration on your server: website information, Administrator (Approval permission), email sending and email server

INews is an open-source simple community program designed to make it easy for developers to obtain a sharing website that is generally compatible with Hacker News and is more beautiful and can run across terminals (Responsive. Quick Start: Install: run the iNews program configuration on your server: website information, Administrator (Approval permission), email sending and email server

INews is an open-source simple community program designed to make it easy for developers to obtain a sharing website that is generally compatible with Hacker News and is more beautiful and can run across terminals (Responsive.

Quick Start:
  • Install: run the iNews program on your server.
  • Configuration: website information, Administrator (Approval permission), email sending and email server settings, etc.

Related information:

Home: http://inews.io/

Managed address: https://github.com/Trimidea/inews

CSDN reporter interviewed iNews development team leader Zhao Ge (Weibo: @ hfcorriez), to share with you why to develop iNews and the technical and difficult points used in development.


Zhao Ge

CSDN: Hacker News is also open-source. Why do we need to implement iNews? What is the original intention?

Zhao Ge:Hacker News is a good application in terms of functions and content. We initially wanted to start with open source-directly use it. However, HN is more implemented than Arch, and we are not familiar with Arch, so I decided to write it myself for function expansion.

About the original intention. From the product perspective, we should start with my partner @ sofish. We are Apple's loyal users and often share some applications with each other. Over time, this idea emerges: to be a community that shares Apple news and applications, for Apple's increasing device data in China over the past few years, many people have the same requirements as us, so we started to do it. Technically speaking, its structure is similar to Hacker News, the appearance should be more beautiful and suitable for mobile apps. Finally we implemented it and launched the http://inews.io. Although the expectations have not yet been fully met, at least the first step has been taken. In terms of the program itself, after going online for a while, many friends hope to use it on their own websites, later, more and more people sought to use it and provided suggestions. Based on our open-source attitude, they finally decided to use it for everyone.

CSDN: How is iNews technically implemented?

Zhao Ge:Based on PHP, iNews uses Mysql storage and phpmig for database version management. On the framework, the backend uses my own Restful framework Pagon for development. The front end uses @ sofish's typo.css, validator. js and other open-source libraries. Before the release of the first version, we hope to start with the most basic functions and go online> fast iteration. The entire development process was very fast and it took only one and a half days to complete. Some optimizations and fixes will be made soon. We also adopt some good third-party services: sending emails with SendGrid, using NewRelic for application monitoring, and using Dropbox for database backup.

Here, I would like to add one more point: in terms of technology selection, technical adaptation products are the most important. Do not force yourself to use PHP, Node, or Ruby. Choosing the PHP-based Pagon framework allows us to implement the iNews. io function more quickly.

CSDN: How many developers are there in total? What are the technical difficulties and highlights of such UGC projects? How did you solve this problem?

Zhao Ge:Only me and my partner @ sofish. Some people should join the open source program one after another. In fact, some people have developed the program together. For iNews, there are not many technical difficulties. There are several important points to consider: security, performance, ease of use, adaptation (Responsive), and social access.

Security is mainly caused by XSS and database filtering. The Pagon framework has implemented automatic XSS processing. As long as the safe_query option is enabled, XSS is automatically filtered during template rendering. The database uses a paris database, which uses PDO to process SQL statements. PDO will escape the data and store it again.

Performance is actually a very general topic, iNews. i/O data samples are too small, so it is difficult to see how the performance is. The average output time is only about 30 ms. For the front-end, Google Pagespeed is used for testing: Mobile, 85/100, and desktop 95/100; this is higher than many websites. High performance is related to logic simplicity and implementation methods. If you need good performance, you need to consider all aspects. Here I will briefly talk about the basic idea of PHP: The simpler the code, the better. Do not use too many magic methods, try to use the built-in PHP method, use the latest stable version 5.4, install APC extension on the server, and run PHP In Nginx + FPM mode. Second, the development process of the Pagon framework itself also has high performance requirements, so we have made a lot of effort in code quality and performance, which is also the basis of application performance. Only index optimization is performed on the database to achieve better query performance. Performance also involves a lot. As a startup application, performance is not perfect enough and you don't need to put it first. Here we won't talk about what we haven't done.

In front-end systems, cross-terminal adaptation should be the most appropriate support for modern applications. @ Sofish there is a lot of research in this area, so our iNews can be accessed well on mobile devices.

Social access is actually not a difficult issue. It only requires a good encapsulation to solve the problem, and the re-development cost is a little higher. I think PHP third-party authentication libraries are very common, but there is still a third-party authentication library for opauth. The encapsulation is a bit messy, but it can be used together. If it is Node, there are a lot of good libraries, such as everyauth and passport. If the PHP community can be as active as the Node community, the problem can be better solved.

CSDN: What mechanisms or Algorithms does iNews use in content recommendation?

Zhao Ge:INews initially started with the Hacker News algorithm, and added the comments to the weight later. The reason is that comments are an important part of this community. Comments represent communication, and the value of the content may exist if there is communication. if there is only a "TOP", it is considered as a weight, the heated discussion may seem unfair. However, if the weight of each comment is the same as that of each "TOP", it seems unreasonable. "TOP" means approval and comment means communication, therefore, the comment should be slightly lower than the "TOP" weight. This is more reasonable. This is the final solution.

CSDN: What are the innovative features of iNews?

Zhao Ge:If we are talking about innovation, I would like to propose a design model: MOVE. Many people have seen this design pattern and abandoned the traditional MVC practices. Model, Operator, View, and Event are used to sort out the encoding process. Operator may be the most confusing and innovative place for everyone. Opeartor is literally an Operator. Opeartor abandons the reusability of controllers and mixed code. It splits each operation into an independent operator and organizes it into a tree-like process for encapsulation, it is a sort of coding process. INews has some simple understanding and implementation of the operator, but it does not fully use the operator, or mainly uses MVC as the basis. This kind of attempt will gradually become mature, this mode may gradually be fully used for development.

[Open Source interview] this series of articles is devoted to interviews with excellent open source project authors and teams at home and abroad, exploring the stories behind the project and more technical details, as well as project promotion and promotion. At the same time, we also hope that the majority of open-source developers and enthusiasts can independently recommend or recommend more excellent open-source projects. Welcome to the message or @ csdn r & D channel.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.