每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;微博:https://weibo.com/openingsource;电报群 https://t.me/OpeningSourceOrg

2018年11月8日:开源日报第245期

今日推荐开源项目:《咕咕咕 pigeon-maps》传送门:GitHub链接

推荐理由:这个项目是一个轻型的 React 地图,比起有更多功能的 Google 地图来说更加注重便于加载的性能,而且作为地图插件来说也依然具备基础的功能。当然了,兴许大家还会有个疑问:“为什么项目叫做鸽子地图?” 当然了,即使起了鸽子的名字,它也不会真的咕咕咕,下面是作者给出的原话:

Pigeons are experts in magnetoreception. Good pigeons can find their way home from anywhere.

Magnets were essential in making the first maps. With a good map you can find your way home from anywhere.

Thus, pigeon.

2018年11月8日:开源日报第245期

今日推荐英文原文:《Beginner’s Web Development Guide Part 2: Backend》作者:Pavels

原文链接:https://medium.com/devtrailsio/beginners-web-development-guide-part-2-backend-fd466212dbfc

推荐理由:Web 开发系列教程第二部分——语言(包括编译语言和脚本语言),数据库以及消息处理

Beginner’s Web Development Guide Part 2: Backend

2018年11月8日:开源日报第245期

This post is part of a series of posts for beginner web developers. Also check out “Part 1: Frontend”, “Part 3: Platforms and Tools” and “Part 4: Cloud Deployment”.

Today we continue our intro to web development. In the previous post we started with exploring frontend development, and today we are going to talk about backend development.

Backend development, also sometimes called server-side development, refers to developing the processes that happen on the server and are usually not visible to the users. A web UI can send requests to the backend asking to render some HTML, save user input in a database, authenticate a user, send an email or process a payment request. Although this part of the application is transparent for the user, it’s in no way less important. This is the heart and brains of your application.

2018年11月8日:开源日报第245期2018年11月8日:开源日报第245期

The color coding of the chart is very simple: yellow lines show the basic things you need to learn, orange represents more advanced topics that you can leave for later, and grey are niche topics that might be useful for special projects.

Languages

Compared to frontend development, the choice of programming languages on the backend is much wider and you are free to one a solution depending on your use case and environment.

There are many ways to classify programming languages, and we made an arbitrary decision to group them by scripting and compiled languages. Have to admit, though, that this is not completely accurate. Some of the scripting languages are actually compiled on the fly, and some compiled languages could have interpreters. This division, however, serves as a convenient starting point for our analysis.

Scripting languages

Languages that don’t require explicit compilation before execution are called scripting languages, or interpreted languages. As opposed to compiled languages, they do not produce a binary executable. Rather the code is evaluated and run on the fly. Sometimes, scripting languages are easier to get started with, since you don’t have to write code in a strict manner required by the compiler. This, however, means that errors that could have been discovered during compilation will only become apparent during runtime.

Some of the more popular scripting languages are:

  • Node.js is a server-side JavaScript runtime. It supports its own set of JavaScript features and provides a set of API’s to satisfy backend use cases, such as working with the file system. Learning Node.js is a great choice since by learning a single language you’ll be able to work both on the frontend and the backend. Node.js has several popular frameworks, such as expresskoa or LoopBack.
  • Python is a general-purpose programming language. It’s simple syntax and clear constructs make it quite easy to learn for beginners. Python is widely used for developing applications but has also gained significant traction for doing scientific research and working with artificial intelligence. There are currently two major versions being used: Python 2 and Python 3. One of the popular projects developed on Python is the Django content management system. Flask is a popular micro-framework for web development.
  • PHP — another popular programming language for web applications. The language itself has a low entry barrier for beginners but also provides more advanced features for intermediate users. Some of the most popular projects created on PHP are WordPress and Drupal, with the former being arguably the most used content management system in the world. Notable frameworks are LaravelSymfony and CodeIgniter.
  • Ruby — a scripting language designed to be simple and natural to read and write. The most popular development framework for Ruby is Ruby on RailsJekyll, a popular static website generator is built on Ruby.

Compiled languages

Code written using a compiled language needs to be first compiled into a binary file before it can be executed. Although this needs an explicit extra step to be performed by the developer, it also brings additional benefits. The compiler can analyze the code for mismatches and give you early feedback about potential problems. Some compilers can also optimize the resulting bytecode for a particular platform ensuring superior performance. Although compiled languages might have a higher entry barrier than scripting languages, they are usually preferable in large projects due to the additional safety measures and more descriptive code.

There’s a large selection of languages to choose from.

  • Java is a high-level object-oriented programming language developed by Sun Microsystems and currently maintained by Oracle. Java designed to be portable between different platforms: the sources are compiled to Java bytecode that can be run on a Java Virtual Machine for any platform. It’s a highly mature language with a lot of different frameworks for developing web applications, the most popular being Spring. Additionally, Java can be used for developing Android applications. Although there are trends in considering Java old fashioned and inferior to other JVM languages, such as Kotlin, it is still one of the most popular programming languages. Java is extremely popular in the enterprise sector.
  • C# is another high-level object-oriented programming language developed by Microsoft. Originally developed to be used on Windows, it can now be used to build cross-platform applications using the relatively new .NET Core runtime. One of the most popular frameworks for building web applications using C# is ASP.NET Core. C# is popular among companies adopting Microsoft’s technology stack.
  • Go is a relatively young language developed by Google that’s quickly gaining popularity. It’s designed to be less verbose than Java or C# and based on simple primitives, intentionally leaving out some of the complex constructs that are present in other languages. Go is extremely fast, has a minimal memory footprint and has first-class concurrency support, so it’s a good candidate for projects where speed and low resource consumption are of importance. The library and tool ecosystem around Go is still developing and we’re seeing a lot of interesting projects appear among the community. Go has gained significant popularity in blockchain development.
  • Kotlin is a language developed by JetBrains and a close competitor of Java. Kontlin runs on the Java virtual machine, but can also be compiled into JavaScript. It’s designed to be less verbose than Java, adds first-class function support and offers additional safety measures to avoid common errors. Like Java, it can also be used to develop Android applications.
  • Scala is another JVM-based language and an alternative to Java. It has a more concise syntax, additional safety features and makes heavy use of functional programming.
  • Erlang — a functional language designed for concurrency and high availability. Erlang is popular in applications where high performance and scalability is critical. Popular use cases include image and signal processing or analysis of large amounts of data.
  • Haskell — another functional programming language that is valued for its powerful typing system and a design that helps to produce clear and reliable code. Since it’s a functional language, it also scales efficiently and offers good performance.

Databases

An important ability of most applications is to store user’s data. It is usually done using special software called database management systems (DBS). A DBS provides access to underlying data storages allowing allow the applications to store, retrieve and update data. There are different kinds of databases optimized for different shapes and volumes of data. In this guide, we’ll have a look at the two most popular types: relational and non-relational.

Relational

Relational databases store data in tables, where rows represent entries, and columns — entry attributes. Rows in different tables can be linked using foreign keys to represent relations between different types of entries. For example, if you’re building an online store, you might have a table for storing orders with columns such as “order number”, “client name” and “shipping address” where each row represents a separate order. Information about the ordered items will be stored in a different table called “order items”, with references to the order table.

Most relational databases use a language called Structured Query Language (SQL) or its dialect to query or modify the data. Because of this, they are often called SQL databases.

Popular relational databases are:

  • Oracle Database is a database developed by Oracle. Due to its high scalability and powerful feature set, it’s often used by large enterprises. Its less frequently used for small and midsize projects due to its high license costs.
  • MySQL — a free open-source database developed by a Swedish company MySQL AB and currently owned by Oracle. MySQL can use different storage engines for each table to store and use data differently. MySQL is used for a wide range of cases, however, it is very popular for web applications, especially in the so-called LAMP (Linux, Apache, MySQL, PHP) stack. It also offers several paid editions for large-scale users.
  • SQL Server also referred to as MSSQL, is a database maintained by Microsoft. It has a number of different editions for handling various workloads and data volumes. SQL Server is a major competitor of Oracle and is popular among Microsoft stack users.
  • PostgreSQL — is a free open source database developed by a worldwide team of volunteers. It provides a rich set of features and is capable of handling large workloads.

Non-relational

Non-relation databases store data in models other than tables. There are different models you can choose depending on your use cases, such as storing key-value pairs, documents, graph relations or time-series. Although non-relation databases have been around for a while, they have recently experienced a surge of popularity due to simpler design and easier scaling.

Non-relation databases are also referred to as NoSQL databases since most of them use their own query language instead of SQL.

These three databases are frequently used in web development.

  • MongoDB is a free open source document database that stores JSON-like objects. You can store and retrieve these objects and map them to objects in your application. It also has the usual querying and aggregation capabilities. MongoDB is a good candidate for applications where data consistency is not a primary concern.
  • Redis is an in-memory key-value database often used to temporarily store cached data and transfer messages. Since such data does not necessarily need to be persisted, saving data to disk can either be disabled or delayed, to increase performance. Redis can store different values types, such as strings, numbers, lists, maps etc.
  • Elastic Search is an open-source text search and analytics engine. It allows you to store text documents and produces a searchable text index. Elastic Search is commonly used for log analytics (particularly as part of the ELK stack) and free text document search.

Messaging

Sometimes server-side components need to trigger jobs that need to be executed in the background. For example, asking for a business-reports may trigger a lengthy process that will generate the report and e-mail it to the user, without the user having to wait for it. To do that we need to be able to send a message to a different component and be sure that it’s processed successfully. If the job fails, it needs to be restarted. Software that provides such functionality is called a message broker.

The two most popular messages brokers are:

  • RabbitMQ is a traditional message broker that supports different message delivery models and routing rules. It guarantees that the message will be delivered and processed by the consumer. Failed messages can be stored in the dead-letter queue. RabbitMQ works through the standard AMPQ protocol that is also supported by other message brokers and client libraries.
  • Apache Kafka is a stream processing engines, that can also be used as a message broker. Apart from providing most of the standard message broker features, it also offers advanced features, such as being able to re-process messages from history. It also provides greater performance that allows processing high volumes of messages.

If you endured these two chapters, then you should already have an idea of technologies used for both backend and frontend development. I encourage you to follow the links and do some research before you decide and what do you want to specialise in.

In the next chapter, we’ll have a look at the tooling that every developer should know.


每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;微博:https://weibo.com/openingsource;电报群 https://t.me/OpeningSourceOrg