Click here to Skip to main content
15,904,926 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Strong Typing Pin
eggsovereasy6-May-07 19:10
eggsovereasy6-May-07 19:10 
GeneralRe: Strong Typing Pin
Chris Maunder8-May-07 7:45
cofounderChris Maunder8-May-07 7:45 
GeneralRe: Strong Typing Pin
XTAL25611-May-07 2:33
XTAL25611-May-07 2:33 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 2:45
Tristan Rhodes8-May-07 2:45 
GeneralRe: Strong Typing Pin
Marcus J. Smith8-May-07 2:48
professionalMarcus J. Smith8-May-07 2:48 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 6:46
Tristan Rhodes8-May-07 6:46 
GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 7:34
mvePIEBALDconsult8-May-07 7:34 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 8:19
Tristan Rhodes8-May-07 8:19 
<br />
public class SessionWrapper<br />
{<br />
<br />
private HttpSessionState session;<br />
<br />
// Constants<br />
<br />
public SessionWrapper()<br />
{<br />
session = HttpContext.Current.Session;<br />
}<br />
<br />
public string UserName<br />
{<br />
get{return (string)session[SE_USER_NAME];}<br />
set{session[SE_USER_NAME] = value;}<br />
}<br />
<br />
public int? LastPurchase<br />
{<br />
get{return (int?)session[SE_LAST_PURCHASE];}<br />
set{session[SE_LAST_PURCHASE] = value;}<br />
}<br />
<br />
// Etc<br />
<br />
}<br />
<br />


I'm actualy working on a code generator to build stuff like that for me, but at the time it was written manualy.

My argument was its a strongly typed wrapper that exposes other developers to exactly what they need, what type it is, and hides the constants.

T



-------------------------------

Carrier Bags - 21st Century Tumbleweed.

GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 9:37
mvePIEBALDconsult8-May-07 9:37 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 9:43
Tristan Rhodes8-May-07 9:43 
GeneralRe: Strong Typing Pin
PIEBALDconsult8-May-07 11:38
mvePIEBALDconsult8-May-07 11:38 
GeneralRe: Strong Typing Pin
Tristan Rhodes8-May-07 22:31
Tristan Rhodes8-May-07 22:31 
GeneralRe: Strong Typing Pin
PIEBALDconsult9-May-07 17:13
mvePIEBALDconsult9-May-07 17:13 
GeneralRe: Strong Typing Pin
Marcus J. Smith8-May-07 8:11
professionalMarcus J. Smith8-May-07 8:11 
GeneralRe: Strong Typing Pin
urbane.tiger7-May-07 20:44
urbane.tiger7-May-07 20:44 
GeneralReusable Code Pin
kin3tik3-May-07 9:31
kin3tik3-May-07 9:31 
GeneralRe: Reusable Code Pin
PIEBALDconsult3-May-07 11:57
mvePIEBALDconsult3-May-07 11:57 
AnswerRe: Reusable Code Pin
DavidNohejl3-May-07 12:29
DavidNohejl3-May-07 12:29 
GeneralRe: Reusable Code Pin
Rob Graham3-May-07 12:43
Rob Graham3-May-07 12:43 
GeneralRe: Reusable Code Pin
PIEBALDconsult3-May-07 13:58
mvePIEBALDconsult3-May-07 13:58 
GeneralRe: Reusable Code Pin
kin3tik3-May-07 19:56
kin3tik3-May-07 19:56 
GeneralRe: Reusable Code Pin
PIEBALDconsult5-May-07 6:00
mvePIEBALDconsult5-May-07 6:00 
GeneralRe: Reusable Code Pin
Sylvester george20-Jun-07 3:12
Sylvester george20-Jun-07 3:12 
GeneralThis is just beautiful! Pin
jchigg20001-May-07 5:59
jchigg20001-May-07 5:59 
GeneralRe: This is just beautiful! Pin
CPallini1-May-07 7:46
mveCPallini1-May-07 7:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.