Discussion:
Blog post: "Immutable data (ditching the wax tablet)"
Hal Fulton
2015-08-25 15:12:37 UTC
Permalink
For those who might care...

Blog post: "Immutable data (ditching the wax tablet)"
http://rubyhacker.com/blog2/immutable-data-ditching-the-wax-tablet.html

Cheers,
Hal
Chris Hulan
2015-08-25 16:15:19 UTC
Permalink
Nice
Thanks for sharing
Post by Hal Fulton
For those who might care...
Blog post: "Immutable data (ditching the wax tablet)"
http://rubyhacker.com/blog2/immutable-data-ditching-the-wax-tablet.html
Cheers,
Hal
Thyago Barbosa Rodrigues
2015-08-25 17:36:09 UTC
Permalink
That was a really nice, exactly what I needed.
I was *starting* to think about that. You, kind Sir, just saved me a lot of
time =]

I've been struggling with history lately. Since you mentioned, there's
something I can't quite understand yet.
Say a User wants to update his Profile.
So, I guess I'd make a dup of this Profile, save the new one and leave the
old one for history.
How would I know that the most recent one is the current Profile without
changing something on the old one?
I may be locked in a wrong mindset here, but I think I'd need an "active:
bool" field or some other flag
to set to "false" on the old one and would be "true" for the new one.
Then, Id search for the-one-True-Profile whenever I need that User's
profile.

And, by the way: if we alter the Profile, didn't we just alter the User?

Those were the things I'd spend the week googling and reading about, I
guess.
If anyone could shed some light on those questions, that would be awesome.

Thanks, and congrats on a great blog post!
--
GrÌße,
Thyago Barbosa Rodrigues

"Who loves not wine, women and song,
remains a fool his whole life long"
(Martin Luther)

"Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt." (Albert
Einstein)
Daniel Llinas
2015-08-25 17:44:52 UTC
Permalink
<<How would I know that the most recent one is the current Profile without
changing something on the old one?>>

Couldn't you just retrieve the profile with the most recent created_at
timestamp?



On Tue, Aug 25, 2015 at 1:36 PM, Thyago Barbosa Rodrigues <
Post by Thyago Barbosa Rodrigues
That was a really nice, exactly what I needed.
I was *starting* to think about that. You, kind Sir, just saved me a lot
of time =]
I've been struggling with history lately. Since you mentioned, there's
something I can't quite understand yet.
Say a User wants to update his Profile.
So, I guess I'd make a dup of this Profile, save the new one and leave the
old one for history.
How would I know that the most recent one is the current Profile without
changing something on the old one?
bool" field or some other flag
to set to "false" on the old one and would be "true" for the new one.
Then, Id search for the-one-True-Profile whenever I need that User's
profile.
And, by the way: if we alter the Profile, didn't we just alter the User?
Those were the things I'd spend the week googling and reading about, I
guess.
If anyone could shed some light on those questions, that would be awesome.
Thanks, and congrats on a great blog post!
--
GrÌße,
Thyago Barbosa Rodrigues
"Who loves not wine, women and song,
remains a fool his whole life long"
(Martin Luther)
"Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt." (Albert
Einstein)
--
"I know of no more encouraging fact than the unquestioned ability of a man
to elevate his life by conscious endeavor."

--Henry David Thoreau
Thyago Barbosa Rodrigues
2015-08-25 17:57:10 UTC
Permalink
I'll think about that option, thanks =]
It looks a little weird to me still, but would work perfectly on the
scenario I gave.
Probably just my old habits.
Post by Daniel Llinas
<<How would I know that the most recent one is the current Profile without
changing something on the old one?>>
Couldn't you just retrieve the profile with the most recent created_at
timestamp?
On Tue, Aug 25, 2015 at 1:36 PM, Thyago Barbosa Rodrigues <
Post by Thyago Barbosa Rodrigues
That was a really nice, exactly what I needed.
I was *starting* to think about that. You, kind Sir, just saved me a lot
of time =]
I've been struggling with history lately. Since you mentioned, there's
something I can't quite understand yet.
Say a User wants to update his Profile.
So, I guess I'd make a dup of this Profile, save the new one and leave
the old one for history.
How would I know that the most recent one is the current Profile without
changing something on the old one?
bool" field or some other flag
to set to "false" on the old one and would be "true" for the new one.
Then, Id search for the-one-True-Profile whenever I need that User's
profile.
And, by the way: if we alter the Profile, didn't we just alter the User?
Those were the things I'd spend the week googling and reading about, I
guess.
If anyone could shed some light on those questions, that would be awesome.
Thanks, and congrats on a great blog post!
--
GrÌße,
Thyago Barbosa Rodrigues
"Who loves not wine, women and song,
remains a fool his whole life long"
(Martin Luther)
"Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt." (Albert
Einstein)
--
"I know of no more encouraging fact than the unquestioned ability of a man
to elevate his life by conscious endeavor."
--Henry David Thoreau
--
GrÌße,
Thyago Barbosa Rodrigues

"Who loves not wine, women and song,
remains a fool his whole life long"
(Martin Luther)

"Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt." (Albert
Einstein)
Eric Wong
2015-08-25 19:02:30 UTC
Permalink
Post by Thyago Barbosa Rodrigues
That was a really nice, exactly what I needed.
I was *starting* to think about that. You, kind Sir, just saved me a lot of
time =]
I've been struggling with history lately. Since you mentioned, there's
something I can't quite understand yet.
Say a User wants to update his Profile.
So, I guess I'd make a dup of this Profile, save the new one and leave the
old one for history.
Sounds like you can steal an idea from git :)
Post by Thyago Barbosa Rodrigues
How would I know that the most recent one is the current Profile without
changing something on the old one?
Maintain a stable reference (user ID, login name), and point that to
the latest version.

This is analogous to a "ref" in git (e.g. a branch name or tag)
which is a human-friendly pointer to a commit SHA-1
Post by Thyago Barbosa Rodrigues
bool" field or some other flag
to set to "false" on the old one and would be "true" for the new one.
Then, Id search for the-one-True-Profile whenever I need that User's
profile.
You can try doing what git does with commit history. In other words, a
singly linked-list (assuming linear history with no merges) and updating
only a reference.

ref to user would be something like "thyagobr" is a pointer to
"aba33135"

commit aba33135
parent bbafe223
date 2015-08-13
address 123 Main St

commit bbafe223
parent 5613aadb
date 2012-01-14
address 123 Elm St

...

Before 2015-08-13, the ref "thyagobr" was a pointer to bbafe223,
and before 2012-01-14, it pointed to 5613aadb

Unlike sorting profiles by timestamp as proposed by Daniel,
this git-like method notices when a row gets deleted accidentally.

Performance is also hurt when sorting (unless you cache the result to a
ref) as in this git-like way.

This git-like way requires two lookups (or a JOIN) but can be done
in constant time for all lookup and update common operations.
Post by Thyago Barbosa Rodrigues
And, by the way: if we alter the Profile, didn't we just alter the User?
Yes, but the user becomes a pointer to various snapshots of the profile
Tom Cloyd
2015-08-25 19:15:58 UTC
Permalink
Hal,

That's two for two. I've read two of your blogs, and come away educated in
both cases. This has clarified something for me that has long been a
mystery. I'm impressed and grateful. Thank you.

Tom
Post by Eric Wong
Post by Thyago Barbosa Rodrigues
That was a really nice, exactly what I needed.
I was *starting* to think about that. You, kind Sir, just saved me a lot
of
Post by Thyago Barbosa Rodrigues
time =]
I've been struggling with history lately. Since you mentioned, there's
something I can't quite understand yet.
Say a User wants to update his Profile.
So, I guess I'd make a dup of this Profile, save the new one and leave
the
Post by Thyago Barbosa Rodrigues
old one for history.
Sounds like you can steal an idea from git :)
Post by Thyago Barbosa Rodrigues
How would I know that the most recent one is the current Profile without
changing something on the old one?
Maintain a stable reference (user ID, login name), and point that to
the latest version.
This is analogous to a "ref" in git (e.g. a branch name or tag)
which is a human-friendly pointer to a commit SHA-1
Post by Thyago Barbosa Rodrigues
bool" field or some other flag
to set to "false" on the old one and would be "true" for the new one.
Then, Id search for the-one-True-Profile whenever I need that User's
profile.
You can try doing what git does with commit history. In other words, a
singly linked-list (assuming linear history with no merges) and updating
only a reference.
ref to user would be something like "thyagobr" is a pointer to
"aba33135"
commit aba33135
parent bbafe223
date 2015-08-13
address 123 Main St
commit bbafe223
parent 5613aadb
date 2012-01-14
address 123 Elm St
...
Before 2015-08-13, the ref "thyagobr" was a pointer to bbafe223,
and before 2012-01-14, it pointed to 5613aadb
Unlike sorting profiles by timestamp as proposed by Daniel,
this git-like method notices when a row gets deleted accidentally.
Performance is also hurt when sorting (unless you cache the result to a
ref) as in this git-like way.
This git-like way requires two lookups (or a JOIN) but can be done
in constant time for all lookup and update common operations.
Post by Thyago Barbosa Rodrigues
And, by the way: if we alter the Profile, didn't we just alter the User?
Yes, but the user becomes a pointer to various snapshots of the profile
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Human beings are not born once and for all on the day their mothers give
birth to them,
but...life obliges them over and over again to give birth to themselves.

~ Gabriel García Márquez

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tom Cloyd, MS MA LMHC (WA)
Psychotherapist (psychological trauma, dissociative disorders)
Spokane, Washington, U.S.A: (435) 272-3332
<< ***@tomcloyd.com >> (email)
<< TomCloyd.com >> (website)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zhangxiaopeng (Eric)
2015-08-26 09:02:04 UTC
Permalink
unsubscribe
James Olinda
2015-08-26 13:15:18 UTC
Permalink
Unsubscribe



Sent using CloudMagic
[https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.2.9&pv=5.1.1] On Wed, Aug
26, 2015 at 5:02 AM, Zhangxiaopeng (Eric) < ***@huawei.com
[***@huawei.com] > wrote:
unsubscribe
如是般若
2015-08-26 13:17:46 UTC
Permalink
Unsubscribe
Fabien Inan
2015-11-01 08:58:02 UTC
Permalink
Zach Peavy
2016-06-28 14:47:28 UTC
Permalink
Luca Ortis
2018-10-11 14:59:07 UTC
Permalink
Unsubscribe

[Loading Image...]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Mail priva di virus. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Loading...