Timeline for Adding field to the class at runtime - design pattern
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 16, 2014 at 14:50 | answer | added | Jonathan Eunice | timeline score: 5 | |
Aug 8, 2014 at 8:28 | comment | added | Kevin Hogg | Design Patterns by type (Wikipedia) | |
Aug 8, 2014 at 5:26 | comment | added | user22815 | I have had good success with putting as many fields as make sense on the object itself, and using arbitrary properties for whatever the customer comes up with on their own. It is not ideal, but requires less code maintenance. | |
Jul 9, 2014 at 5:08 | comment | added | Shadows In Rain | Why not just use map datatype? In DB it may be represented as {id} + {id, key, value}, if you not asking for performance. | |
Jul 9, 2014 at 4:39 | answer | added | Guy Schalnat | timeline score: 0 | |
May 23, 2014 at 13:46 | comment | added | Nikos M. | There is the State Desing Pattern a-la Gang-of-Four, which makes an object appear to change its type or class at run-time. Other alternatives are Observer Design Pattern or a Proxy Design Pattern | |
May 23, 2014 at 10:29 | answer | added | astef | timeline score: 0 | |
Apr 18, 2014 at 16:53 | comment | added | Filip | Tony: I'm using Java here, but consider it pseudo coude :). Would C# allow me to persist that dynamic object into database? I doubt it, as databse needs to know structure of data up front. | |
Apr 18, 2014 at 12:51 | comment | added | Tony | Not sure what language you are using, but if it is C# you could use a dynamic type which basically stores a KVP in a dictionary kinda like what you are doing on products and allows you to just tack on properties without having to directly add them to the collection as a collection. You will not have strong typing though. I know you asked for a design pattern but I don't feel you would need anything complex to use them. msdn.microsoft.com/en-us/magazine/gg598922.aspx | |
Apr 18, 2014 at 5:35 | history | tweeted | twitter.com/#!/StackProgrammer/status/457029634035843072 | ||
Apr 18, 2014 at 3:12 | answer | added | quantdev | timeline score: 0 | |
Apr 18, 2014 at 0:41 | comment | added | psr | steve-yegge.blogspot.com/2008/10/universal-design-pattern.html | |
Apr 18, 2014 at 0:19 | review | First posts | |||
Apr 18, 2014 at 0:21 | |||||
Apr 18, 2014 at 0:02 | history | asked | Filip | CC BY-SA 3.0 |