Pull to refresh
931.9

Programming *

The art of creating computer programs

Show first
Rating limit
Level of difficulty

Why it is important to apply static analysis for open libraries that you add to your project

Reading time7 min
Views827
PVS-Studio and Awesome header-only C++ libraries

Modern applications are built from third-party libraries like a wall from bricks. Their usage is the only option to complete the project in a reasonable time, spending a sensible budget, so it's a usual practice. However, taking all the bricks indiscriminately may not be such a good idea. If there are several options, it is useful to take time to analyze open libraries in order to choose the best one.
Read more →
Total votes 1: ↑0 and ↓1-1
Comments1

Why code reviews are good, but not enough

Reading time3 min
Views902
image1.png

Code reviews are definitely necessary and useful. It's a way to impart knowledge, educate, control a task, improve code quality and formatting, fix bugs. Moreover, you can notice high-level errors related to the architecture and algorithms used. So it's a must-have practice, except that people get tired quickly. Therefore, static analysis perfectly complements reviews and helps to detect a variety of inconspicuous errors and typos. Let's look at a decent example on this topic.
Read more →
Rating0
Comments0

Checking QEMU using PVS-Studio

Reading time14 min
Views632
image1.png

QEMU is a rather well-known application for emulation. Static analysis can help developers of complex projects such as QEMU catch errors at early stages and generally improve quality and reliability of a project. In this article, we will check the source code of the QEMU application for potential vulnerabilities and errors using the PVS-Studio static analysis tool.
Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

Dark code-style academy: line breaks, spacing, and indentation

Reading time4 min
Views2.4K

Hey guys! Let me walk you through the next part of our dark-style code academy. In this post, we will discover some other ways how to slow down the reading speed of your code. The next approaches will help you to decrease maintenance and increase a chance to get a bug in your code. Ready? Let's get started.

Read more
Total votes 1: ↑1 and ↓0+1
Comments1

Dark code-style academy: spoil if statement

Reading time3 min
Views2.1K

image


Do you want to raise your salary? Do you want always to be in demand? Do you want to have your job as long as you want? It is absolutely real! You just need to change the way you write your code. Basically, you need to increase your job security. You have to write code which will be almost impossible to maintain for everyone except you. And in these series of articles, I will tell you how to achieve it. Welcome under the cut.

Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

Static Analysis: From Getting Started to Integration

Reading time9 min
Views1.2K
Sometimes, tired of endless code review and debugging, you start wondering if there are ways to make your life easier. After some googling or merely by accident, you stumble upon the phrase, "static analysis". Let's find out what it is and how it can be used in your project.

Read more →
Total votes 4: ↑3 and ↓1+2
Comments0

Static Analysis: baseline VS diff

Reading time6 min
Views1.2K
If you use static analyzers, you will have, sooner or later, to address the task of making their integration into existing projects easier, where fixing all warnings on legacy code is unfeasible.

The purpose of this article is not to help with integration but rather to elaborate on the technicalities of the process: the exact implementations of warning suppression mechanisms and pros and cons of each approach.

image1.png

Read more →
Total votes 5: ↑5 and ↓0+5
Comments0

Spring transaction management. Isolation and propagation

Reading time3 min
Views26K

Introduction


In my opinion transaction management is a really important topic for each backend developer. In general, people don’t pay attention to it while using Spring framework.


But I think, it is important to know how to use transactions properly. Because sometimes can happen that there was an exception thrown inside your method, but transaction was not rolled back and it is not clear why? Or some other “strange” cases.

Read more →
Total votes 6: ↑6 and ↓0+6
Comments0

The Testcontainers’ MongoDB Module and Spring Data MongoDB Reactive in Action

Reading time19 min
Views5.2K

1. Introduction


How can I easily test my MongoDB multi-document transaction code without setting up MongoDB on my device? One might argue that they have to set it up first because in order to carry out such a transaction it needs a session which requires a replica set. Thankfully, there is no need to create a 3-node replica set and we can run these transactions only against a single database instance.

Read more →
Rating0
Comments0

C2x: the future C standard

Reading time8 min
Views16K

image


I strain to make the far-off echo yield
A cue to the events that may come in my day.
(‘Doctor Zhivago’, Boris Pasternak)

I’ll be honest: I don’t write in pure C that often anymore and I haven’t been following the language’s development for a long time. However, two unexpected things happened recently: С won back the title of the most popular programming language according to TIOBE, and the first truly interesting book in years on this language was published. So, I decided to spend a few evenings studying material on C2x, the future version of C.


Here I will share with you what I consider to be its most interesting new features.

Read more →
Total votes 22: ↑21 and ↓1+20
Comments3

Small things that pollute your code

Reading time4 min
Views2.3K
I'm not going to discuss global things like design patterns and so on, as there's enough literature on that topic. Instead, I'd like to attract your attention to some small things that still affect lucidity and maintainability of a code.

Polluting code with 'test-only' methods or access modifiers


First of all, if you give access to something that shouldn't be used in production code, it gets used sooner or later. Just because it exist. The argument that it's an internal stuff doesn't work as it absolutely shouldn't be matter, writing you a library or isolated project! Treat people who will add anything to your internal codebase the same way as if they use your existing code as a different library.

Thus, if for some reason in test, you need to call something that should not be called on prod — use reflection or whatever else but do not expose it in production code! And there's no reason to afraid of reflection for test proposes, at the end, you using Mockito, shouldn't it be bad in that case as well?
Read more →
Total votes 4: ↑3 and ↓1+2
Comments1

How to find an English teacher. Part 2

Reading time4 min
Views882
image

This is a continuation of story about using Data Science for finding an English teacher. If you have not read it yet - there is an opportunity to become familiar with it

Briefly  -  we had information about language teachers and tried to apply some basic ideas using pandas and our expectations. Unfortunately we got stuck on the third step, because there is not enough information for resolving our the last requirements  -  we need not more 3 candidates at the end.

Disclaimer
It is an approach based on my own experience and can be unsuitable to your point of view, ideas, or principles.
Rating0
Comments0

PVS-Studio is now in Compiler Explorer

Reading time4 min
Views1K
image1.png

Not so long ago, a landmark event has happened: PVS-Studio appeared in Compiler Explorer! Now you can quickly and easily analyze the code for errors right on the godbolt.org site (Compiler Explorer). This feature opens up a large number of new possibilities – from quenching curiosity about the analyzer's abilities to being able to quickly share check results with a friend. This article will cover the topic on how to use these features. Caution – large GIFs!
Read more →
Total votes 1: ↑1 and ↓0+1
Comments0

How to find an English teacher. Part 1

Reading time5 min
Views1.5K


In the modern world, here and there ideas are arising about using data science for an extra benefit. For instance, Google can use a history of watched videos for providing recommendations about new ones. Online shops are using a recommendation system for increasing your receipt. However… if companies use the data for their benefit, could we do the same for own needs such as looking an online English teacher?


Disclaimer

It is an approach based on my own experience and can be unsuitable to your point of view, ideas, or principles.

Total votes 2: ↑1 and ↓10
Comments0

How to introduce a static code analyzer in a legacy project and not to discourage the team

Reading time8 min
Views1.6K


It is easy to try a static code analyzer. But it requires skills to introduce it in the development of an old large project. If the approach is incorrect, the analyzer can add work, slow down development, and demotivate the team. Let's briefly discuss how to properly integrate static analysis into the development process and start using it as part of CI/CD.
Read more →
Total votes 1: ↑1 and ↓0+1
Comments0

Implementation of Linked List in PHP

Reading time3 min
Views7.1K

A linked list is a linear data structure, which contains node structure and each node contains two elements. A data part that stores the value at that node and next part that stores the link to the next node as shown in the below image:


Linked List Node

The first node also known as HEAD is usually used to traverse through the linked list. The last node (next part of the last node) points to NULL. The list can be visualized as a chain of nodes, where every node points to the next node.


Linked List

Implementation of Singly Linked List


Representation:


In PHP, singly linked list can be represented as a class and a Node as a separate class. The LinkedList class contains a reference of Node class type.


//node structure
class Node {
  public $data;
  public $next;
}

class LinkedList {
  public $head;

  //constructor to create an empty LinkedList
  public function __construct(){
    $this->head = null;
  }
};

Read more →
Total votes 7: ↑5 and ↓2+3
Comments4

Future of PHP: Bright or Dull?

Reading time4 min
Views3.6K
image

PHP is a popular scripting language founded in 1995 designed to perform several functions. Do you think the essence of PHP has faded away since the newer programming languages and frameworks have come into the market?

If you think so, then let me tell you that your perception is totally wrong! In fact, in the contemporary market of custom software development, it has become the most popular language in server-side programming.

image
Read more →
Total votes 4: ↑4 and ↓0+4
Comments0

The Anatomy of LuaJIT Tables and What’s Special About Them

Reading time10 min
Views3.1K
I don't know about you, but I really like to get inside all sorts of systems. In this article, I’m going to tell you about the internals of Lua tables and special considerations for their use. Lua is my primary professional programming language, and if one wants to write good code, one needs at least to peek behind the curtain. If you are curious, follow me.


Read more →
Total votes 28: ↑28 and ↓0+28
Comments0

Programming as an endless educational pursuit

Reading time5 min
Views1.3K
When one embarks on the journey to master the craft of programming, they come to the realisation that it has no finish line. No matter how good you are, there are still things to learn, solutions to explore.

Today, we’ll talk about the importance of remaining a lifelong student, language adoption trends according to StackOverflow and why programming itself might not be what you end up learning to become better.

Read more →
Total votes 9: ↑9 and ↓0+9
Comments0

Authors' contribution