Image for post
Image for post

ES6, also known as ECMAScript 2015, is a significant update to the language, and the first update to the language after ES5 was standardized in 2009.

In this series of posts, I will try to cover the main changes that have been introduced in ES6.

Image for post
Image for post

Features

  • let and const
  • arrow functions
  • template literals
  • spread and rest operators
  • destructuring arrays and objects

let and const

Image for post
Image for post

let and const keywords allows you to declare variables that are limited to the scope of a block statement, or expression on which it is used, unlike the var keyword, which declares a variable globally, or locally to an entire function regardless of block scope. …


Image for post
Image for post

Code editor keyboard shortcuts can save you a lot of time. They can replace several operations with just one.

So a programmer who actively uses keyboard shortcuts will surpass the speed of writing code for a programmer that does not use shortcuts if they are equal in level of knowledge. In this post, I’d like to share my top 10 favorite keyboard shortcuts from the JetBrains editors.

Why JetBrains IDE?

Image for post
Image for post

I have tried many different editors during my work. Almost all of them performed the function of a code editor well, but during the development process, you need to not only write code, but, for example, upload your code to a remote test server, manage the state of the data in the database, and save changes with help of version control systems and much more. And therefore, in addition to editors, it was necessary to install many other applications. All this had to be done until I installed ide from JetBrains. …


Image for post
Image for post

In a single HTML document possible that some CSS rules will conflict with one another. CSS uses a mechanism called the cascade to resolve any such conflicts.

Before describing how the cascade works, we need to consider two of its main components — specificity and inheritance.

Specificity

Image for post
Image for post

Specificity refers to the relative weights of various rules. It determines which styles apply to an element when more than one rule could apply. Table shows how much each part of a selector contributes to the total specificity of that selector.

Specificity values are cumulative; thus, a selector containing two attribute identifiers and a class identifier (e.g.,[name=”email”][type=”checkbox”].hello) has a specificity of 0,0,3,0. Specificity values are sorted from right to left; thus, a selector containing 4 element identifiers ( 0,0,0,4) has a lower specificity than a selector containing just a single class identifier ( 0,0,1,0). …


Image for post
Image for post

CSS selector is the part of a CSS rule set that actually selects the content you want to style. Let’s look at all the different kinds of selectors

Universal Selector

Universal selector selects all the elements on a webpage.

Example:

* {
margin: 0;
padding: 0;
}

Element Selector

Also referred to simply as a “type selector”, this selector must match one or more HTML elements of the same name.

Example:

p {
font-family: arial, helvetica, sans-serif;
}

Id Selector

An ID selector is declared using a hash, or pound symbol (#) preceding a string of characters. The stringof characters is defined bythe developer. …


Image for post
Image for post

Background

Last week I needed to implement authorization via SAML

Security Assertion Markup Language (SAML) is an open standard for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider. SAML is an XML-based markup language for security assertions (statements that service providers use to make access-control decisions).

The project I’m working on is written in PHP, so the choice of a library for saml is obvious, it’s simplesamlphp. In the process of working on the task, a couple of unpleasant problems arose related to simplesamlphp. Today I would like to tell about them. …


Image for post
Image for post

A well-written project is more stable, easier to maintain, more enjoyable to work with. In the following post, we will discuss some best practices that will allow you to take your project to a new level.

Best Practices

Deliver Working Software

Pair programming is a development technique in which two programmers work on a specific problem together.

Test-driven development improves code design and quality.

Work Together

Scrum meetings are short meetings used to plan, review, and increase accountability and clarity across a team.

Retrospectives are periods for reflection at the end of each sprint.

Pair programming

Image for post
Image for post

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. …


Image for post
Image for post

Background

After the client requests to connect to the database, the client will be prompted to enter the user password. If the client does not enter the password, the database server will disconnect after a timeout period.

In other words, before the server actively disconnects, the connection needs to occupy a slot, which is one of max_connection.

https://www.postgresql.org/docs/9.6/static/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SECURITY

authentication_timeout (integer)

Maximum time to complete client authentication, in seconds.

If a would-be client has not completed the authentication protocol in this much time, the server closes the connection.

This prevents hung clients from occupying a connection indefinitely.

The default is one minute (1m). This parameter can only be set in the postgresql.conf file or on the server command line.


Image for post
Image for post

There are several types of indexes in PostgreSQL. Beginners or those who have little to do with the databases use the index that PostgreSQL creates by default (B-tree) or do not create them at all. It is necessary to know what indexes are used in which situations to speed up the execution of queries. In this post, I will try to examine this briefly and simply, without going into details of the internal structure of indexes.

PostgreSQL Indexes:

  • Hash
  • B-tree
  • GiST
  • SP-GiST
  • GIN
  • RUM
  • BRIN
  • Bloom

Hash

The hash index stores the hash value of the indexed field VALUE, and only supports equal-value queries. …


Image for post
Image for post

In a previous post, we looked at principles to avoid when writing code. You can read it here. In this post, we will look at SOLID design principles, programming standards that all developers must understand well to create good architecture.

SOLID is a mnemonic acronym for:

  • Single Responsibility
  • Open-closed
  • Liskov Substitution
  • Interface Segregation
  • Dependency Inversion

Single Responsibility

  • Each object should be assigned one single responsibility.
  • A specific class should solve a specific problem.

STUPID example

class Order
{
public function calculateTotalSum() {...}
public function getItems() {...}
public function getItemCount() {...}
public function addItem() {...}
public function deleteItem() {...}

public function load() {...}
public function save() {...}
public function update() {...}
public function delete() {...}

public function printOrder() {...}
public function showOrder() {...} …

Image for post
Image for post

If you want to write understandable, flexible and maintainable code, you need to know how bad code looks like first. In this post, I will discuss bad practices that should be avoided when writing code.

STUPID is a mnemonic acronym for:

  • Singleton
  • Tight Coupling
  • Untestability
  • Premature Optimization
  • Indescriptive Naming
  • Duplication

Singleton

  • Programs that use global state are very difficult to test;
  • Programs that depend on global status hide their dependencies.
  • Often you can replace using a singleton with something better.
  • Avoiding everything static is very important to prevent strong coupling.

Tight Coupling

  • Tight coupling is a generalization of the singleton problem.
  • Coupling is a measure of how related routines or modules are. …

About

Marat Badykov

I created this blog for sharing my thoughts about programming, software engineering and other cool stuff. https://it.badykov.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store