HNHacker News
TopNewBestAskShowJobs

BerislavLopac

31,993 karma · joined July 21, 2008

submissionscomments
BerislavLopac··on The five orders of ignorance (2000)
> As the article outlines: you need to acquire that knowledge. And they’re many ways to do that.

Domain-driven design is all about this.

BerislavLopac··on Donating the Model Context Protocol and establishing the Agentic AI Foundation
So you're basically saying: "nobody is using the standard that we have defined, let's solve this by introducing a new standard". Fair enough.
BerislavLopac··on Donating the Model Context Protocol and establishing the Agentic AI Foundation
> the point of MCP is that it's discoverable by an AI

What exactly makes it more discoverable than, say, pointing the AI to an OpenAPI spec?

BerislavLopac··on JSON Schema Demystified: Dialects, Vocabularies and Metaschemas
> you still don't get a good overview

True, when focusing only on the schemas as code. But good tooling could provide links and similar.

> do you have something public to show

Just a very early PoC [0]. I'm slowly working my way through a very long to-do list of improvements, but I'm lacking time and resources to do it more efficiently.

[0] https://schematalog.com/

BerislavLopac··on Iceland declares ocean-current instability a national security risk
> Spitting distance to the mediterranean.

People tend to underestimate how cold it gets in the interior of countries generally seen as the "sunny Mediterranean" - from Croatia, Montenegro, Albania and even Greece.

BerislavLopac··on JSON Schema Demystified: Dialects, Vocabularies and Metaschemas
One underutilised feature of JSON Schema is referencing external schemas and reusing them in multiple places, rather than copying them over and over again. The main hurdle to a better use of this feature is the lack of a good standard for schema repositories; I've been working on addressing this, but it's difficult to find the time. :/
BerislavLopac··on JSON Schema Demystified: Dialects, Vocabularies and Metaschemas
Yes, I've been searching for a long time for a good solution to allow non-coding people to visually design JSON Schemas. The closest thing I found is the schema editor in the amazing Stoplight service, but that is sadly not open source.
BerislavLopac··on You can't cURL a Border
The Life in the UK test certainly needs updating.
BerislavLopac··on Tech companies are firing everyone to "fund AI", spending money on each other
MANGA is the new FAANG.
BerislavLopac··on Why should I care what color the bikeshed is? (1999)
Thank you. You can expect my ophthalmologist bill in the mail, after I used "fuchsia". o.O
BerislavLopac··on A new pay-per-mile tax system is reportedly being considered by the Government
> I'd be inclined to provide a government API, and require the manufacturers to provide the data in a specified format. Make it part of type approval for use on the UK roads.

Knowing how this industry works, good luck making something like this a reality, especially in a single country. Even if the EU tried enforcing something like that (with the UK piggybacking on it), it is still a small portion of the market.

Sadly, this is not a technical problem, but a political one. That said, I agree with you, and we can always dream.

BerislavLopac··on A new pay-per-mile tax system is reportedly being considered by the Government
True, but that is a general mileage - it doesn't tell you where it was made. I.e. how much of it was made abroad, how much was on local roads and how much on motorways etc.
BerislavLopac··on Kafka is Fast – I'll use Postgres
To be fair, any (immutable) data structure that includes the creation timestamp can be a queue. It might not be a good queue, but it can be used as one.
BerislavLopac··on A new pay-per-mile tax system is reportedly being considered by the Government
The key question I see here is: how would a vehicle be tracked?

There are two options:

1. A dongle with GPS, mobile connectivity and some other features would be installed to all vehicles. This makes it easy to implement the system, but would be a logistical nightmare.

2. The government could receive information directly from the manufacturers, but that a) can be a privacy nightmare, b) would work only on cars manufactured after 2016 or so, and c) is insanely complex to implement, due to differences and incompleteness of various manufacturer's API implementations (source: I worked on one such system).

One solution that comes to mind is to use the same technology that already exists for traffic violations: when a vehicle enters or leaves the motorway it would get its licence plate scanned, and a fee would be applied to that vehicle's account. The owner can then be charged in a number of different ways - immediately, or periodically, or after a certain threshold was reached - whichever is the most practical.

BerislavLopac··on Understanding Spec-Driven-Development
I'll just put this here as a reminder: https://www.commitstrip.com/en/2016/08/25/a-very-comprehensi...
BerislavLopac··on Ask HN: Abandoned/dead projects you think died before their time and why?
HyperCard
BerislavLopac··on Show HN: ut – Rust based CLI utilities for devs and IT
> Data Generation: uuid (v1, v3, v4, v5)

The new versions 7 and 8 are really a must these days, especially v7.

BerislavLopac··on UML diagram for the DDD example in Evans' book
For the architectural documentation like this one, the C4 Model [0] is a much better fit than UML - primarily because it's less rigid in notation and modeling components. And in terms of tooling, I find IcePanel [1] to have the right combination of flexibility and simplicity.

[0] https://c4model.com/

[1] https://icepanel.io/

BerislavLopac··on Rust Any part 3: we have upcasts
The second comment refers to Zawinski's Law [0].

[0] https://en.wikipedia.org/wiki/Jamie_Zawinski#Zawinski's_Law

BerislavLopac··on Architecture Patterns with Python
Well, again, that is not completely straightforward - what exactly is a "persisted object"? We have two things here that are usually called entities:

1. The domain entities, which are normally represented as native objects in our codebase. They have no idea whether they need to be persisted and how.

2. The database entities, which are - in RDBs at least - represented by tables.

It is not uncommon that our entities of the first type can easily be mapped 1:1 to our entities of the second type - but that is far from guaranteed. Even if this is the case, the entities will be different because of the differences between the two "worlds": for example, Python's integer type doesn't have a direct equivalent in, say, PostgreSQL (it has to be converted into smallint, integer, bigint or numeric).

In my "correction" above I was talking about the domain entities, and my phrasing that they "need database access" is not fully correct; it should have been "need to be persisted", to be pedantic.

BerislavLopac··on Architecture Patterns with Python
> for each entity have a separate class to provide the database access

Let me correct you: for each entity that needs database access. This is why I'm talking about layers here: sometimes entities are never persisted directly, but only as "parts" or "relations" of other entities; in other cases you might have a very complex persistence implementation (e.g. some entities are stored in a RDB, while others in a filesystem) and there is no clear mapping.

I recommend you to approach this from the perspective of each domain entity individually; "persistability" is essentially just another property which might or might not apply in each case.

BerislavLopac··on Architecture Patterns with Python
OK, let's first define some things.

What we are talking about is a "transformation" or "mapper" layer isolating your domain entities from the persistence. If this is what we call "Repository" then yes, I absolutely agree with you -- this is the right approach to this problem. But if the "Repository pattern" means a complex structure of abstract and concrete classes and inheritance trees -- as I have usually seen it implemented -- then it is usually an overkill and rarely a good idea.

BerislavLopac··on Architecture Patterns with Python
Some parts of this book are extremely useful, especially when it's talking about concepts that are more general than Python or any other specific language -- such as event-driven architecture, commands, CQRS etc.

That being said, I have a number issues with other parts of it, and I have seen how dangerous it can be when inexperienced developers take it as a gospel and try to implement everything at once (which is a common problem with any collection of design patterns like this.

For example, repository is a helpful pattern in general; but in many cases, including the examples in the book itself, it is a huge overkill that adds complexity with very little benefit. Even more so as they're using SQLAlchemy, which is a "repository" in its own right (or, more precisely, a relational database abstraction layer with an ORM added on top).

Similarly, service layers and unit of work are useful when you have complex applications that cover multiple complex use cases; but in a system consisting of small services with narrow responsibilities they quickly become overly bloated using this pattern. And don't even get me started with dependency injection in Python.

The essential thing about design patterns is that they're tools like any other, and the developers should understand when to use them, and even more importantly when not to use them. This book has some advice in that direction, but in my opinion it should be more prominent and placed upfront rather at the end of each chapter.

BerislavLopac··on Architecture Patterns with Python
> faking (not mocking!!)

You might like this: https://martinfowler.com/bliki/TestDouble.html

BerislavLopac··on The role of developer skills in agentic coding
The obligatory CommitStrip: https://www.commitstrip.com/en/2016/08/25/a-very-comprehensi...
BerislavLopac··on The Gang of Four is wrong and you don't understand delegation (2012)
> I see OOP as fundamentally one key concept: that there are functions which "belong to" specific types, and all other operations on those types go through the functions that "belong to" them

I would go even further:

All programming essentially consists of two things only:

  1. data structures (often, but not necessarily, formalised as "types")
  2. mechanisms to transform that data (functions, methods, algorithms, tasks, whatever)
Programming paradigms essentially describe different ways to organise these two: functional programming, for example, keeps the two strictly separate; in OOP the mechanisms are "attached" to the data they operate on. Of course, in practice there are many combinations and variations, with more and less flexibility (from strictly closed objects to mixins and similar), but this is the foundation.
BerislavLopac··on The Gang of Four is wrong and you don't understand delegation (2012)
In my experience, design patterns cause a lot of problems when developers reach the stage when they understand them enough to know how to implement them, but not when (and even more importantly, when not).

Most design patterns were invented as workarounds to specifics and limitations of certain languages/paradigms, and work great in that case -- but are much more limited, or even downright dangerous, when used in other contexts. As a clear example, the GoF patterns focus on strongly typed OOP languages like Java or C++, and will result in difficult to maintain bloatware if copied directly to dynamic languages like Python, Javascript or PHP (source: been there, done that, got the t-shirt).

BerislavLopac··on Show HN: FastOpenAPI – automated docs for many Python frameworks
I'm honestly disappointed how OpenAPI keeps being used over and over as documentation, and extremely rarely as what it excels at, which is specification.

We build all kinds of frameworks with routing and request/response validation, and then extract that into OpenAPI format, ofteng having to jump through hoops to adapt our internal data types and structures into those supported by JSON Schema. Instead, we could be doing the opposite: writing the OpenAPI spec first, and use tooling to make routing and validation based on it in an automated way. That has been done before [0] [1], but we're still just scratching the surface of what is possible.

Yes, I am aware that it's not easy to manually write the specs using JSON or even YAML, but we need a better focus on tooling around it; currently only Stoplight [2] gives a solid level of support in that area.

[0] https://connexion.readthedocs.io

[1] https://pyapi-server.readthedocs.io/

[2] https://stoplight.io/

BerislavLopac··on Stelvio: Serverless AWS for Python Devs
There is also Mangum [0], which can wrap up any ASGI app and deploy it as a lambda.

[0] https://mangum.fastapiexpert.com/

BerislavLopac··on uv downloads overtake Poetry for Wagtail users
As much as I am glad that it looks like one solution is being more and more accepted as the golden standard, I'm a little disappointed that PDM [0] -- which has been offering pretty much everything uv does for quite some time now -- has been completely overlooked. :(

[0] https://pdm-project.org

← PreviousPage 2 of 34Next →