Oren Eini

aka Ayende Rahien

Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,582
|
Comments: 51,212

Copyright ©️ Ayende Rahien 2004 — 2025

Privacy Policy · Terms
filter by tags archive
stack view grid view
  • architecture (611) rss
  • bugs (450) rss
  • challanges (123) rss
  • community (379) rss
  • databases (481) rss
  • design (895) rss
  • development (641) rss
  • hibernating-practices (71) rss
  • miscellaneous (592) rss
  • performance (397) rss
  • programming (1085) rss
  • raven (1448) rss
  • ravendb.net (532) rss
  • reviews (184) rss
  • 2025
    • June (4)
    • May (10)
    • April (10)
    • March (10)
    • February (7)
    • January (12)
  • 2024
    • December (3)
    • November (2)
    • October (1)
    • September (3)
    • August (5)
    • July (10)
    • June (4)
    • May (6)
    • April (2)
    • March (8)
    • February (2)
    • January (14)
  • 2023
    • December (4)
    • October (4)
    • September (6)
    • August (12)
    • July (5)
    • June (15)
    • May (3)
    • April (11)
    • March (5)
    • February (5)
    • January (8)
  • 2022
    • December (5)
    • November (7)
    • October (7)
    • September (9)
    • August (10)
    • July (15)
    • June (12)
    • May (9)
    • April (14)
    • March (15)
    • February (13)
    • January (16)
  • 2021
    • December (23)
    • November (20)
    • October (16)
    • September (6)
    • August (16)
    • July (11)
    • June (16)
    • May (4)
    • April (10)
    • March (11)
    • February (15)
    • January (14)
  • 2020
    • December (10)
    • November (13)
    • October (15)
    • September (6)
    • August (9)
    • July (9)
    • June (17)
    • May (15)
    • April (14)
    • March (21)
    • February (16)
    • January (13)
  • 2019
    • December (17)
    • November (14)
    • October (16)
    • September (10)
    • August (8)
    • July (16)
    • June (11)
    • May (13)
    • April (18)
    • March (12)
    • February (19)
    • January (23)
  • 2018
    • December (15)
    • November (14)
    • October (19)
    • September (18)
    • August (23)
    • July (20)
    • June (20)
    • May (23)
    • April (15)
    • March (23)
    • February (19)
    • January (23)
  • 2017
    • December (21)
    • November (24)
    • October (22)
    • September (21)
    • August (23)
    • July (21)
    • June (24)
    • May (21)
    • April (21)
    • March (23)
    • February (20)
    • January (23)
  • 2016
    • December (17)
    • November (18)
    • October (22)
    • September (18)
    • August (23)
    • July (22)
    • June (17)
    • May (24)
    • April (16)
    • March (16)
    • February (21)
    • January (21)
  • 2015
    • December (5)
    • November (10)
    • October (9)
    • September (17)
    • August (20)
    • July (17)
    • June (4)
    • May (12)
    • April (9)
    • March (8)
    • February (25)
    • January (17)
  • 2014
    • December (22)
    • November (19)
    • October (21)
    • September (37)
    • August (24)
    • July (23)
    • June (13)
    • May (19)
    • April (24)
    • March (23)
    • February (21)
    • January (24)
  • 2013
    • December (23)
    • November (29)
    • October (27)
    • September (26)
    • August (24)
    • July (24)
    • June (23)
    • May (25)
    • April (26)
    • March (24)
    • February (24)
    • January (21)
  • 2012
    • December (19)
    • November (22)
    • October (27)
    • September (24)
    • August (30)
    • July (23)
    • June (25)
    • May (23)
    • April (25)
    • March (25)
    • February (28)
    • January (24)
  • 2011
    • December (17)
    • November (14)
    • October (24)
    • September (28)
    • August (27)
    • July (30)
    • June (19)
    • May (16)
    • April (30)
    • March (23)
    • February (11)
    • January (26)
  • 2010
    • December (29)
    • November (28)
    • October (35)
    • September (33)
    • August (44)
    • July (17)
    • June (20)
    • May (53)
    • April (29)
    • March (35)
    • February (33)
    • January (36)
  • 2009
    • December (37)
    • November (35)
    • October (53)
    • September (60)
    • August (66)
    • July (29)
    • June (24)
    • May (52)
    • April (63)
    • March (35)
    • February (53)
    • January (50)
  • 2008
    • December (58)
    • November (65)
    • October (46)
    • September (48)
    • August (96)
    • July (87)
    • June (45)
    • May (51)
    • April (52)
    • March (70)
    • February (43)
    • January (49)
  • 2007
    • December (100)
    • November (52)
    • October (109)
    • September (68)
    • August (80)
    • July (56)
    • June (150)
    • May (115)
    • April (73)
    • March (124)
    • February (102)
    • January (68)
  • 2006
    • December (95)
    • November (53)
    • October (120)
    • September (57)
    • August (88)
    • July (54)
    • June (103)
    • May (89)
    • April (84)
    • March (143)
    • February (78)
    • January (64)
  • 2005
    • December (70)
    • November (97)
    • October (91)
    • September (61)
    • August (74)
    • July (92)
    • June (100)
    • May (53)
    • April (42)
    • March (41)
    • February (84)
    • January (31)
  • 2004
    • December (49)
    • November (26)
    • October (26)
    • September (6)
    • April (10)
Comparison page for RavenDB and MongoDB
  previous post next post  
May 14 2010

Some code just make me queasy

time to read 1 min | 42 words

And this one hits a lot of the high notes in that regard:

image

Three properties to say the same thing?!

Tweet Share Share 9 comments
Tags:
  • WTF?!

  previous post next post  

Comments

Tengiz
14 May 2010
22:59 PM
Tengiz

Dev A said "there only so many Genres and it'll be easy to query.

A found another gig and left. Second dev looked at it and said: 'The other guys design sucks! I will normalize it so it looks normalized and so i don't have to change anything when they rename punk to classical." He added GenreId and did not remove Genre so 'nothing breaks'. He got fired when no 'pop' items where sold in the third quarter 'cause no one could find any in the store. The subsequent consulting firm used an ORM that had a mapping convention setup by a departed employee to expect FK columns to be named as
<entityReference. They did not know that it could be changed. So they worked hard and added another column so that customers would be able to find 'pop' items. - That's how it went.

Demis Bellot
14 May 2010
23:28 PM
Demis Bellot

@Tengiz

Sounds like a normal story on a multi-developer project, but isn't this pre-release software and yet the current maintainer never bothered to re-factor it?

I mean if the current maintainer can't be sure that he can modify existing software and be sure 'nothing breaks' then it sounds like you're dealing with an un-healthy project with a very dim future. IMHO any hindrance to change or re-factoring are one of the main causes that will lead to an un-maintainable code-base.

Surely this is one of the benefits of working in a statically-typed language?

In a code-first world where the db schema is binded to the C# model than a simple 'Find Usages' or a 'Remove field' and 'Re-compile all' to make sure nothing breaks will pick up any errors.

This is why I always try to code-first where-ever possible and have C# to talk to the outside world rather than the more cubersome alternative of mapping the outside world onto your C# models.

I'm only guessing this is what has happened here, otherwise leaving them all in doesn't make any sense.

dave-ilsw
15 May 2010
01:02 AM
dave-ilsw

Or somebody decided that it was too expensive to have to look up the Genre name in the Genre table when displaying a list of Albums, so they decided to duplicate the Genre name in the Album table.

Simon
15 May 2010
02:56 AM
Simon

Is this an IdeaBlade devforce project?

Dmitry
15 May 2010
03:53 AM
Dmitry

It looks like an Entity Framework context badly configured.

There is no need to expose references if you enable lazy loading and prevent the designer to generate code. Also, there is no need to expose foreign keys when you can create stub objects.

Jarek Kowalski
15 May 2010
04:39 AM
Jarek Kowalski

This looks like entity class generated with EFv4 designer usign default settings:

  • Genre - is a reference - most likely to a Genre class

  • GenreId - is a foreign key (new thing in EFv4)

  • GenreReference - special object which implements IRelatedEnd through which you can use to manipulate the reference in a generic way (to achieve explicit reference loading, etc.) - this concept has been around since first version of EF and is kept around mostly for back-compat reasons.

I know it does not look pretty, but EF provides automatic fixup to keep properties in sync - you can basically change one property and the other ones will be synchronized (or nulled out if synchronization is not possible because the object ha not been loaded).

You can argue whether the fixup (or in general any non-trivial behavior of proeprty setters) is the best thing, but it helps automate some common scenarios, such as data binding and serialization.

BTW. This is not the only way to write an object model in EF - you can totally write your classes as POCOs. Neither GenreId or GenreReference are required in this case.

jmorris
15 May 2010
06:56 AM
jmorris

Looks like just another bit of shitty code that needs refactoring...nothing to see here move along.

Stephen
15 May 2010
14:54 PM
Stephen

I'm sure you could just use the different entity generators, hell even the POCO one if you wanted, it would be more work, but compared to nhibernate, its still less work.

El Guapo
16 May 2010
05:21 AM
El Guapo

This is nothing. You guys want to see something really scary? Try using EF on a table that has mutliple FKs to another table.

Comment preview

Comments have been closed on this topic.

Markdown formatting

ESC to close

Markdown turns plain text formatting into fancy HTML formatting.

Phrase Emphasis

*italic*   **bold**
_italic_   __bold__

Links

Inline:

An [example](http://url.com/ "Title")

Reference-style labels (titles are optional):

An [example][id]. Then, anywhere
else in the doc, define the link:
  [id]: http://example.com/  "Title"

Images

Inline (titles are optional):

![alt text](/path/img.jpg "Title")

Reference-style:

![alt text][id]
[id]: /url/to/img.jpg "Title"

Headers

Setext-style:

Header 1
========
Header 2
--------

atx-style (closing #'s are optional):

# Header 1 #
## Header 2 ##
###### Header 6

Lists

Ordered, without paragraphs:

1.  Foo
2.  Bar

Unordered, with paragraphs:

*   A list item.
    With multiple paragraphs.
*   Bar

You can nest them:

*   Abacus
    * answer
*   Bubbles
    1.  bunk
    2.  bupkis
        * BELITTLER
    3. burper
*   Cunning

Blockquotes

> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
> 
> * You can quote a list.
> * Etc.

Horizontal Rules

Three or more dashes or asterisks:

---
* * *
- - - - 

Manual Line Breaks

End a line with two or more spaces:

Roses are red,   
Violets are blue.

Fenced Code Blocks

Code blocks delimited by 3 or more backticks or tildas:

```
This is a preformatted
code block
```

Header IDs

Set the id of headings with {#<id>} at end of heading line:

## My Heading {#myheading}

Tables

Fruit    |Color
---------|----------
Apples   |Red
Pears	 |Green
Bananas  |Yellow

Definition Lists

Term 1
: Definition 1
Term 2
: Definition 2

Footnotes

Body text with a footnote [^1]
[^1]: Footnote text here

Abbreviations

MDD <- will have title
*[MDD]: MarkdownDeep

 

FUTURE POSTS

  1. fsync()-ing a directory on Linux (and not Windows) - 3 days from now

There are posts all the way to Jun 09, 2025

RECENT SERIES

  1. Webinar (7):
    05 Jun 2025 - Think inside the database
  2. Recording (16):
    29 May 2025 - RavenDB's Upcoming Optimizations Deep Dive
  3. RavenDB News (2):
    02 May 2025 - May 2025
  4. Production Postmortem (52):
    07 Apr 2025 - The race condition in the interlock
  5. RavenDB (13):
    02 Apr 2025 - .NET Aspire integration
View all series

RECENT COMMENTS

  • Can confirm :) still had the old developer license on my other PC, using the Force update now can me a green Your license has...
    By Steve on RavenDB GenAI Deep Dive
  • Steve, Please try that again, I believe that we sorted this out on our end.
    By Oren Eini on RavenDB GenAI Deep Dive
  • Should have kept a screenshot, tried that first but got a response in orange that said something like "it succeeded but the k...
    By Steve on RavenDB GenAI Deep Dive
  • Steve, You should have access to that feature, even with an older license. Please go to About > Force Update in the licen...
    By Oren Eini on RavenDB GenAI Deep Dive
  • For other people like me, my developer license was created before these features were available so I think since it didn't ex...
    By Steve on RavenDB GenAI Deep Dive

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats
}