Category Archives: Architecture

DDD/Clean Architecture go linters

Origin (in Russian) Tech talk (paid access only, unfortunately): https://conf.ontico.ru/online/hl2023/details/5206668 Presentation: https://docs.google.com/presentation/d/1n5jCie-9tBw3QEEF6NsNco4mS9xYkg52/edit#slide=id.g29c6e2d30cb_0_169 Linters Dependencies between layers: https://github.com/OpenPeeDeeP/depguard https://github.com/fe3dback/go-arch-lint/ Others: https://github.com/nishanths/exhaustive — to check using all microtypes in enums/switches. https://github.com/go-simpler/musttag + https://github.com/maranqz/golangconf2023/blob/main/tags/rules.go — to prevent using struct tags in Domain models (Value Objects). https://github.com/maranqz/gopublicfield — to prevent changing Value Objects (Domain models) from outside of the …

Read more

Clean architecture pattern

The main idea is to have layers that only depend on inner layers (see the image below). Let’s imagine you have a repository that includes several applications. Layers Domain (Entities) Has basic types and interfaces for your application. Including the application config and Registry with all the interfaces. Optionally could also include some common logic …

Read more

Style guide for golang project file structure

Highly recommended. It has a couple of odds like not explaining about /test dir (I assume, they wanted to say to put there only e2e and other integrational tests, not unit-test as the latter should be kept together with the code itself in files like …_test.go). But it’s awesome in general. https://github.com/golang-standards/project-layout

Microservice architecture patterns

Why do you need a microservice architecture? Decrease blast radius of problems and increase flexibility. You want technology diversity in your company. You want to scale your app more granular according to consumer needs. You want newcomers to be productive earlier. You want your company structure to be mirrored with technical responsibilities (it’s mainly about …

Read more

MVC vs Flux

They are all architecture patterns. M is for model. It stores generic logic for the model like fields and calculations based on the fields like validation and stuff. V is for view. It just renders stuff and passes user interactions (events) to its controller via the controller’s API. C is for controller that ties models …

Read more

Принципы SOLID с примерами на php

Из книги Robert Martin «Clean Architecture» Принцип единственной ответственности (Single responsibility) Каждый модуль системы должен иметь только одну причину для изменения === одного владельца (команду). Принцип открытости/закрытости (Open-closed) Система должна легко изменяться добавлением нового кода, а не изменением существующего. Принцип подстановки Барбары Лисков (Liskov substitution) Части программы должны быть взаимозаменяемы, если они реализуют один и …

Read more

Формализованные языки для построения API

http://ru.wikipedia.org/wiki/IDL Самые интересные: Apache Thrift — http://en.wikipedia.org/wiki/Apache_Thrift Гугловый ProtoBuf — http://en.wikipedia.org/wiki/Protobuf Apache Avro — http://en.wikipedia.org/wiki/Apache_Avro. Сравнений этих IDL — тысячи, например: http://www.slideshare.net/IgorAnishchenko/pb-vs-thrift-vs-avro. Но всё-таки имеет смысл делать самому, а из перечисленных брать основные идеи. И самое главное тут — формализация, формализация и ещё раз формализация. Т.е. всё делать вложенными объектами, никаких структур, вперемешку болтающихся, как …

Read more

Fatcache от Twitter — memcache на SSD

https://github.com/twitter/fatcache/blob/master/notes/performance.md

Выступление Jan Jongboom из Cloud9 — «The Architect Way» на YAC-2012

http://events.yandex.ru/talks/300/ Презентация в pdf — http://download.yandex.ru/company/experience/yac2012/jongboom_yac_2012.pdf

Алгоритм конкатенации js-файлов для каждой страницы на лету

Хочется сделать один js-файл на страницу. Думаю над таким алгоритмом. Сразу после процедуры деплоя пользователи грузят кучу отдельных js-файлов, всё как обычно. Первый пользователь, зашедший на страницу, ставит lock в кэш (на 1 минуту), означающий, что именно ему повезло создать единый js-файл. При генерации страницы пути всех подключаемых js-файлов сохраняются в массивчик (у нас уже …

Read more