Как се пише: заместник главен директор или заместник-главен директор?
от Павлина ВърбановаEvery Serialization Framework Should Have Its Own Transient Annotation
от Божидар БожановWe’ve all used dozens of serialization frameworks – for JSON, XML, binary, and ORMs (which are effectively serialization frameworks for relational databases). And there’s always the moment when you need to exclude some field from an object – make it “transient”.
So far so good, but then comes the point where one object is used by several serialization frameworks within the same project/runtime. That’s not necessarily the case, but let me discuss the two alternatives first:
- Use the same object for all serializations (JSON/XML for APIs, binary serialization for internal archiving, ORM/database) – preferred if there are only minor differences between the serialized/persisted fields. Using the same object saves a lot of tedious transferring between DTOs.
- Use different DTOs for different serializations – that becomes a necessity when scenarios become more complex and using the same object becomes a patchwork of customizations and exceptions
Note that both strategies can exist within the same project – there are simple objects and complex objects, and you can only have a variety of DTOs for the latter. But let’s discuss the first option.
If each serialization framework has its own “transient” annotation, it’s easy to tweak the serialization of one or two fields. More importantly, it will have predictable behavior. If not, then you may be forced to have separate DTOs even for classes where one field differs in behavior across the serialization targets.
For example the other day I had the following surprise – we use Java binary serialization (ObjectOutputStream) for some internal buffering of large collections, and the objects are then indexed. In a completely separate part of the application, objects of the same class get indexed with additional properties that are irrelevant for the binary serialization and therefore marked with the Java transient modifier. It turns out, GSON respects the “transient” modifier and these fields are never indexed.
In conclusion, this post has two points. The first is – expect any behavior from serialization frameworks and have tests to verify different serialization scenarios. And the second is for framework designers – don’t reuse transient modifiers/annotations from the language itself or from other frameworks, it’s counterintuitive.
The post Every Serialization Framework Should Have Its Own Transient Annotation appeared first on Bozho's tech blog.
Как се пише: популярен или пополярен?
от Павлина ВърбановаКак се пише: апсида или абсида?
от Павлина ВърбановаМедийно отразяване на участниците в предизборната кампания
от Нели ОгняноваДали партиите ще дадат повече пари за медийно отразяване на предизборната кампания за предстоящия вот на 11-юли в сравнение с кампанията от пролетта? Кои ще са най-предпочитаните медии този път?
Данни от Института за развитие на публичната среда – екипът му осъществява мониторинг.
Конвенция на Съвета на Европа за кинематографичната продукция
от Нели ОгняноваВ Държавен вестник днес е обнародвана Конвенцията на Съвета на Европа за кинематографичната продукция (ревизирана), която наследява и заменя Европейската конвенция за кинематографичната копродукция (ETS № 147) от 1992 г.
Както е известно, обнародването е необходимо, за да влезе една конвенция в сила, макар че не всяка обнародвана конвенция влиза в сила. По силата на чл.19 –
Digital News Report 2021
от Нели ОгняноваДнес е публикуван десетият доклад за цифрови новини Digital News Report 2021 на Института Ройтерс. Той очертава ключовите проблеми, пред които е изправена индустрията в момент на дълбока несигурност и бързи промени.
Доверието в новините нараства средно с шест процентни пункта след пандемията – 44% се доверяват на повечето новини през повечето време. Финландия остава страната с най-високи нива на общо доверие (65%), а САЩ сега има най-ниските нива (29%).
Дялът на хората, плащащи за онлайн новини, остава нисък – 17% са платили за онлайн новини през последната година, Норвегия продължава да води с 45% (+3), следвана от Швеция (30%), САЩ (21%), Финландия (20%), Холандия (17%) и Швейцария (17%). По-малък напредък има във Франция (11%), Германия (9%) и Обединеното кралство (8%). В повечето страни голяма част от цифровите абонаменти отиват само за няколко големи национални медии.
Употребата на смартфон за новини (73%) нараства с най-бързия си темп от много години.
Частта за България е написана от Стефан Антонов.
Журналистите от БНР трябва да са доволни, благодарение на тяхната работа общественото радио води по доверие.
