Forwarded from 🇺🇦 Math.random(): javascript community via @like
This media is not supported in your browser
VIEW IN TELEGRAM
Интересная статья о том, как сделать систему отслеживания посетителей с распознаванием лиц у входной двери за 150$. Система написана на Python, думаю было бы круто написать перевод на JavaScript. https://bit.ly/35HQutm (перевод - https://bit.ly/3ebvHlO)
#python #iot #article
#python #iot #article
emacsway-log: Software Design, Clean Architecture, DDD, Microservice Architecture, Distributed Systems, XP, Agile, etc.
Pattern Specification можно реализовать парой строчек кода, в случае использования JSONB поля для хранения агрегата, путем применения jsonpath. Для реализации метода IsSatisfiedBy подойдет, например, - https://jsonpath2.readthedocs.io/en/latest/ А для компиляции…
seedwork.zip
25.4 KB
В продолжение темы. Прилагаю файлы, которые реализуют этот принцип и компилируют jsonpath-выражение в SQL-запрос к реляционным данным (не JSQNB). Готовый Specification Pattern. Работает как с объектами в памяти, так и с данными в БД. Код сгенерирован by Claude.
См. также:
- https://xn--r1a.website/emacsway_log/1508
- https://xn--r1a.website/emacsway_log/1545
- https://xn--r1a.website/emacsway_log/1564
[UPDATE]: Может быть применён в "OpenAPIs" для передачи критериев выборки с клиента на сервер в GET-параметре запроса.
#Python #DDD #SpecificationPattern
См. также:
- https://xn--r1a.website/emacsway_log/1508
- https://xn--r1a.website/emacsway_log/1545
- https://xn--r1a.website/emacsway_log/1564
[UPDATE]: Может быть применён в "OpenAPIs" для передачи критериев выборки с клиента на сервер в GET-параметре запроса.
#Python #DDD #SpecificationPattern
❤2👍1🔥1
Прекрасная штука для ReadModels. В Repository его использовать тоже, вероятно, можно, но не уверен, что целесообразно.
- Golang
https://github.com/sqlc-dev/sqlc
- Python
https://github.com/sqlc-dev/sqlc-gen-python
- Typescript
https://github.com/sqlc-dev/sqlc-gen-typescript
- Kotlin
https://github.com/sqlc-dev/sqlc-gen-kotlin
Тот же Martin Fowler, создавший моду на ORM, писал:
Глава "Metadata Mapping" книги "Patterns of Enterprise Application Architecture": "reflective program" и "code generation".
Кстати, про CQRS в качестве альтернативы ORM тоже говорил он:
А это, наверное, самый приятный пример Anemic Domain Model на Golang, который я встречал:
- https://github.com/techschool/simplebank
Сопроводительная статья:
"A clean way to implement database transaction in Golang"
- https://dev.to/techschoolguru/a-clean-way-to-implement-database-transaction-in-golang-2ba
Ни к чему не призываю. Я сторонник качественных полноценных доменных моделей, будь то OOP или FP. Анемичные доменные модели не относятся ни к первому, ни ко второму.
#Golang #Python #TypeScript #Kotlin
- Golang
https://github.com/sqlc-dev/sqlc
- Python
https://github.com/sqlc-dev/sqlc-gen-python
- Typescript
https://github.com/sqlc-dev/sqlc-gen-typescript
- Kotlin
https://github.com/sqlc-dev/sqlc-gen-kotlin
Тот же Martin Fowler, создавший моду на ORM, писал:
Generated code is more explicit so you can see what's going on in the debugger; as a result I usually prefer generation to reflection, and I think it's usually easier for less sophisticated developers (which I guess makes me unsophisticated).
—"Patterns of Enterprise Application Architecture" by Martin Fowler, David Rice, Matthew Foemmel, Edward Hieatt, Robert Mee, Randy Stafford
Глава "Metadata Mapping" книги "Patterns of Enterprise Application Architecture": "reflective program" и "code generation".
Кстати, про CQRS в качестве альтернативы ORM тоже говорил он:
ORMs are complex because they have to handle a bi-directional mapping. A uni-directional problem is much easier to work with, particularly if your needs aren't too complex and you are comfortable with SQL. This is one of the arguments for CQRS.
https://martinfowler.com/bliki/OrmHate.html
А это, наверное, самый приятный пример Anemic Domain Model на Golang, который я встречал:
- https://github.com/techschool/simplebank
Сопроводительная статья:
"A clean way to implement database transaction in Golang"
- https://dev.to/techschoolguru/a-clean-way-to-implement-database-transaction-in-golang-2ba
Ни к чему не призываю. Я сторонник качественных полноценных доменных моделей, будь то OOP или FP. Анемичные доменные модели не относятся ни к первому, ни ко второму.
#Golang #Python #TypeScript #Kotlin
GitHub
GitHub - sqlc-dev/sqlc: Generate type-safe code from SQL
Generate type-safe code from SQL. Contribute to sqlc-dev/sqlc development by creating an account on GitHub.
👍5🔥5❤2