News for hackers. Stuff that matters.
Re:Redis Anti-Patterns by paxys on Tuesday October 19, 2021 @01:10AM (#28915063)
> 11. Storing JSON blobs in a string

Oh boy. Turns out 95% of the usage of Redis is an anti-pattern.

Re:Redis Anti-Patterns by cmckn on Tuesday October 19, 2021 @01:59AM (#28915268)
Eh, "anti-patterns" are like "best practices". It really all depends on the actual situation (and hard data). I like to think that programmers get paid the big bucks to actually think, not just do what a blog post tells us to do (and this one seems to mostly be telling us to pay for Redis Enterprise).
Re:Redis Anti-Patterns by nuerow on Tuesday October 19, 2021 @02:31AM (#28915399)
> I like to think that programmers get paid the big bucks to actually think, not just do what a blog post tells us to do

I feel this is a very cynical take on the reality of the software development world.

How much "thinking" anyone does or can do is completely irrelevant if they have no info to start with. "Thinking" only works if either a developer is omniscient, or managed to gather enough reliable info to be able to make decent decisions. As omniscience is not a thing, the next best thing is to gather reliable info from reputable sources.

Now, pray tell, who is expected to have more insight onto how to use Redis the right way than the Redis guys?

I understand that there is a tendency for software developers to think everyone else is an idiot and they are the only ones whose own decisions are good and well justified, but that's just your narcisism getting the best if you. Everyone is operating on a time budget to onboard onto things and deliver results, and if you don't have the benefit of being omniscient or drawing from the prior experience of someone who happened to do things in an acceptable manner then the best thing you can do is read "blog posts" from the project showcasing best practices, isn't it?

Re:Redis Anti-Patterns by Attummm on Tuesday October 19, 2021 @04:08AM (#28915901)
This comment is quite ironic. A condescending comment against perceived condescending comment.

To answer your question.

In marketing there is a rule, the more your audience knows the less effective marketing is.

While trying not come over as condescending. If you study cs data structures and distributed computing. Then the first comment is obvious.

Re:Redis Anti-Patterns by dgb23 on Tuesday October 19, 2021 @08:17AM (#28917261)
I agree. I much rather like the term "convention" or in specific cases "style guide".

It is more honest to call it that way and more _useful_. Because it is much clearer that you're following a convention, what the positives are and specifically what the grounds for discussion around it is.

Re:Redis Anti-Patterns by sushsjsuauahab on Tuesday October 19, 2021 @01:13AM (#28915082)
HASH sounds pretty cool though. Also is "marshalling" JSON really a term that people use instead of deserializing?
Re:Redis Anti-Patterns by iampims on Tuesday October 19, 2021 @01:14AM (#28915088)
Marshaling is serializing.
Re:Redis Anti-Patterns by sushsjsuauahab on Tuesday October 19, 2021 @01:18AM (#28915105)
Based on a Google search of the term, it seems that Go uses that terminology, but others might not...
Re:Redis Anti-Patterns by iampims on Tuesday October 19, 2021 @01:52AM (#28915249)
> In computer science, marshalling or marshaling (US spelling) is the process of transforming the memory representation of an object into a data format suitable for storage or transmission

https://en.m.wikipedia.org/wiki/Marshalling_(computer_scienc...

Re:Redis Anti-Patterns by omnicognate on Tuesday October 19, 2021 @02:18AM (#28915342)
Immediately followed by

> Marshalling can be somewhat similar or synonymous to serialization. Marshalling is describing an intent or process to transfer some object from a client to server, intent is to have the same object that is present in one running program, to be present in another running program, i.e. object on a client to be transferred to and present on the server. Serialization does not necessarily have this intent since it is only concerned about transforming data into a, for example, stream of bytes. One could say that marshalling might be done in some other way from serialization, but some form of serialization is usually used.[1]

I'm most familiar with the term "marshaling" from COM, where it is quite distinct from serialization.

Re:Redis Anti-Patterns by matsemann on Tuesday October 19, 2021 @02:26AM (#28915379)
In Java-land, marshalling is used in xml libraries, and serializing in json libraries. Wonder why they ended up differently.
Re:Redis Anti-Patterns by sodapopcan on Tuesday October 19, 2021 @02:13AM (#28915320)
Python calls it "pickling"[0] which is also pretty cool.

While others have already given examples re "marshalling" I'll go ahead and add one to the pile: Ruby also uses this term[1]. However, in my ~10 years of working with Rub daily, I have never Marshalled anything, nor have I known anyone who has. On the contrary, the few pythonists I talk to on the regular seem to be pickling all the time.

...but I seem to be maybe getting off track here.

[0] https://docs.python.org/3/library/pickle.html

[1] https://ruby-doc.org/core-2.6.3/Marshal.html

Re:Redis Anti-Patterns by quietbritishjim on Tuesday October 19, 2021 @02:23AM (#28915362)
Pickling is just one specific type of marshalling, so the terms are not equivalent. I'm not familiar with Ruby, but from your link it's clear that the Marshal library is also for one specific marshaling format.

By the way, pickling is great for transmitting data at runtime between processes that you own, because it can marshal almost any Python object and it's very fast. But it's bad at storing data (on disk or in a database) because it can execute arbitrary code and the format of the objects can change between package releases. That's quite different from marshaling as JSON, which is a very stable format supporting a deliberately restricted set of types.

Re:Redis Anti-Patterns by sodapopcan on Tuesday October 19, 2021 @09:29AM (#28917858)
You're right—my bad.
Re:Redis Anti-Patterns by kuang_eleven on Tuesday October 19, 2021 @02:16AM (#28915333)
Typically, one wouldn't use the term 'pickling' for JSON however, it's usually used for a more general serialization process. Most of the time I just hear people talk about 'loading' and 'dumping' JSON, also from the Python JSON library.
Re:Redis Anti-Patterns by snoman on Tuesday October 19, 2021 @02:22AM (#28915357)
C++/COM used the term marshalling a lot if I recall.
Re:Redis Anti-Patterns by stuchl4n3k on Tuesday October 19, 2021 @07:05AM (#28916830)
The term is quite commonly used in Java world for serialization, mainly DTOs (e.g. JAXB).