19 Dec 2020
by ignat

We will discuss questions


SOLID – Single responsibility, Open–closed Leaf substitution, Interface segregation и Dependency inversion


SRP – Let’s take an example Active Oberon and take into account my classification of functions (first 4 levels).

const moduleA = { 
  state: {},    - FSM

  mutations: {}, - switch
  actions: {}, - parser
  getters: {}  - repository
} const moduleB = { state: {}, mutations: {}, actions: {}, getters: {} } const store = new Vuex.Store({ modules: { a: moduleA, b: moduleB } })
store.state.a // -> module state moduleA

store.state.b // -> module state moduleB
SpringBootGraphQL/Feed.java at main · Ignat99/SpringBootGraphQL (github.com)
So, Lombok + Feing


1. Object oriented ( the suffix is added to the roots КА)
2. FSM - state machine or  (ЦА)
3. Parallel computing as Zenon (ЛА)
4. Parsing (P)
5. Registers and DMA (ИТЬ)
6. Timing diagrams as in Buran (ТИ)
7. Data storage or writing to database(ХО)


Buran ciclogram:


OCP – it’s easier to consider using the example of 3 multiplication tables among Old Believers (на, же, и)

на – normal multiplication of numbers

же – three-dimensional multiplication

и – time multiplication

If we want to implement all three multiplication tables, we will inherit from the class НА through class ЖЕ to the class И.

If we want to keep the interfaces, then this will be polymorphism.



LSP – this leaf-substitution principle will require some hierarchy of functions. For example, the stacking function will be common for all cells, but if the cells intersect, then contracts will be required to obtain the final result in the case of using leaf.



ISP – so that there are not many arguments in the constructor, it is better to refactor a large class in such a way that in each interface there is an implementation of only one level of the above, then at the upper levels (starting from Registered Transfers or Brokers or Tires or SOA/SOAP).



DIP – here we are talking about the interaction of objects \ perdmet through abstract interfaces, which, as it were, provide an interaction environment at each level. In fact, the complete set of these interfaces can be put into a matrix, and then optimized based on domain analysis (combined in pairs or three at a time, under the condition of uniformity of arguments in the constructor).



The object-oriented paradigm is a concept based on the C language precompiler, which combined variables and functions (methods) into a single structure. Moreover, due to the complication of linking, memory savings were achieved. In particular, various departments have been added for the new type of code. Later, mechanisms for dynamic linking of libraries and directives to the precompiler related to allocation in memory and the work of the garbage collector were added. In order to add modular architecture, the ability to define a namespace has been added. The combination of all these additions led to the emergence of templates, especially in conjunction with the implementation of the STL library – which was borrowed from Lisp and was very convenient in the 2000s for implementing vector and matrix objects.

Based on all these innovations, design patterns emerged.

So, for example, from the global variables of the SI – sigletons turned out. Their difference from just global variables is that in the additional Boost library, references to the allocated memory areas were automatically counted, and when the reference counter was zeroed, the object was automatically deleted.

Hashes were often used for associative storage of string data with access by a string key, so they began to make registries, which, however, could be combined into trees or pools. Now brokers are already used for this, since all this must still be done asynchronously and in a thread.

In particularly severe cases of full-text fast search, they now use ElasticSearch or PostgreSQL with a tree inverse index.

After the spread of local networks, the temptation arose to run functions on one microprocessor, and execute on another remote. This is how the patern factory came into being.

But there was a problem with long names of different classes on different machines, so the builder pattern arose. It’s just a chain of different operations that we can put into a conveyor or a factory method.

Etc. lazy initialization, injected dependency, service locator. Adapter, bridge, linker, decorator, facade, single point of entry, opportunist, proxy. Chain of Responsibility, Action, Interpreter, Iterator, Mediator, Keeper, Listener, Bulletin Board, Sideboard, State, Strategy, Specification, Catheterization, Visitor and One-Time Visitor, Hierarchical Visitor (for working with trees and subtrees – just making sense of heap sort).


Functional programming

It arose on the basis of the LISP language, which became possible due to the presence of a hardware implementation of the FILO call address stack instead of a queue. This was done to reduce the size of the typed code, before that they practiced the sewing code on the FIFO. Later, not only return addresses, but also variables were transferred to the stack. This is how the Fort language arose, which is still perfectly used on processors with a stack architecture. In this language, we explicitly define the depth of the substack for variables.

As you know, real programmers do not use not only the stack, but also general registers. This is a joke, in fact, such a programmer was the only one, and apparently he was a genius.

Thus, if one function changes variables in another function, confusion can arise when these functions are called repeatedly when returning values from the stack at the return point of the function. To prevent this from happening, now hypervisors are used on AMD and Intel microprocessors, which save absolutely all state registers of the microprocessor automatically.

But you can do without a hypervisor if you define a complete list of passed arguments in the function and return all of them when the function finishes executing. Thus, the function does not in any way affect the environment and does not store any states inside itself.

A further development of this direction is free grammars, but unfortunately, their full implementations in the form of a Mealy automaton are quite cumbersome, in contrast to Markov chains of a Moore automaton. Therefore, we are waiting for the quantum computer to become personal and that’s where we will expand. Joke 🙂

Java, streaming, collections, map, high level functions

Java is a very good programming language that supports multiple inheritance and many other features. We have been using it for 20 years since the creation of this language at Sun Microsystems. The main feature, according to the creators, of the language was a single microcode. Such a pseudo-assembler, somewhat close to the modern assembler of ARM microprocessors. As you might have guessed, these microprocessors were extensions of the stack architecture.

More precisely, it was scaling (when simple stacked microprocessors were put in several pieces in a line and a pipeline or RISC architecture was obtained). They also had more registers and a register window, that is, small changes in the addressing logic (in the MIPS architecture). But they did not have hardware instructions for multiplication and division.

Also, the Java language has a very large machine word, which makes it possible to allocate memory at the compilation stage. Which makes garbage collection easier. In general, these systems were created for the design of larger microprocessors, since the cost of addressing errors in memory while working in such programs is very high.

Unfortunately, the creator of the language made a mistake and we got a lot of JVMs of virtual machines and even families of virtual machines. And in general Java bytecode is not portable.


Java provides a new additional package in Java 8 called java.util.stream.

It is a Pipeline that does not store objects. You can use stream to filter, collect, print, and convert from one data structure to other etc.


To save objects for 2 weeks (approximately), you can use Kafka.

SpringBootGraphQL/NosFeedService.java at a3a65916b277927050ff4e439d64313c487d89e5 · Ignat99/SpringBootGraphQL (github.com)


SpringBootGraphQL/NosFeedService.java at a3a65916b277927050ff4e439d64313c487d89e5 · Ignat99/SpringBootGraphQL (github.com)

interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet)



Two interfaces for implementing Map in java: Map and SortedMap, and three classes: HashMap, LinkedHashMap, and TreeMap.

SpringBootGraphQL/GraphqlTracingInstrumentationConfiguration.java at a3a65916b277927050ff4e439d64313c487d89e5 · Ignat99/SpringBootGraphQL (github.com)


High level functions

These are functionals when arguments of the same function are passed to the input of a function. This is especially developed in Kotlin. Such implementations also resemble JS.



JavaScript and JS Frameworks, functions scopes, closures, Virtual DOM and faster mutation in memory, Async Call, promises and Observers


It’s a good language, but building its implementation for SmartTV was a chore, since the options to the compiler compiler were tricky for a number of functions.



Minecraft Edu © 2023