Click here to Skip to main content
15,895,667 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
Rick York30-Nov-19 14:27
mveRick York30-Nov-19 14:27 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
honey the codewitch30-Nov-19 14:28
mvahoney the codewitch30-Nov-19 14:28 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
Marc Clifton1-Dec-19 12:14
mvaMarc Clifton1-Dec-19 12:14 
QuestionInfo on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 3:30
Cp-Coder30-Nov-19 3:30 
AnswerRe: Info on tests mentioning manufacturer's name and product Pin
OriginalGriff30-Nov-19 3:36
mveOriginalGriff30-Nov-19 3:36 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 3:39
Cp-Coder30-Nov-19 3:39 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Nelek30-Nov-19 9:52
protectorNelek30-Nov-19 9:52 
GeneralI love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 1:00
mvahoney the codewitch30-Nov-19 1:00 
One of the keystones, I think, of Good Programming(TM) is to get your tools to do the work, and to do it smartly. This can require a little bit of thinking around corners, but they payout is worthwhile.

In C++ probably the premier example is templates. Sure you can use them for std::vector<T> style containers but you can also use them to coerce your compiler into doing complicated calculations at compile time, like generating parse tables - work your code doesn't have to do at runtime.

In C# one of the most overlooked hidden gems in this category is the garbage collector itself.

What it is, is a fancy graph manager. This is awesome for managing Document Object Model or Abstract Syntax Tree type structures.

For example I have code that works with an external AST called the CodeDOM. I use it to hold the information i get back from parsing my mini programming language (a subset of C#)

The problem with that AST is it doesn't contain all the information i need, so I have to tag it. and tagging can make things stale. If i tag a node with a parent node, what happen when that entire subtree is removed?

Using WeakReference<T> you can tell the garbage collector to let you know when nobody else is holding on to the object anymore, so you can toss it.

So I just keep my cache current using a refresh routine but also judicious use of WeakReference in all my state tags. So when the tree gets altered my dead nodes get pruned automatically.

If I didn't do this, I'd have to somehow track it myself, or make Refresh() more resource hungry.

The GC is your friend, people.

This has been a public service announcement.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

GeneralRe: I love getting the garbage collector to do my other chores too Pin
Greg Utas30-Nov-19 4:07
professionalGreg Utas30-Nov-19 4:07 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 4:13
mvahoney the codewitch30-Nov-19 4:13 
PraiseRe: I love getting the garbage collector to do my other chores too Pin
User 1106097930-Nov-19 5:36
User 1106097930-Nov-19 5:36 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 5:44
mvahoney the codewitch30-Nov-19 5:44 
PraiseRe: I love getting the garbage collector to do my other chores too Pin
Daniel Pfeffer30-Nov-19 8:13
professionalDaniel Pfeffer30-Nov-19 8:13 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 8:21
mvahoney the codewitch30-Nov-19 8:21 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
BillWoodruff30-Nov-19 23:16
professionalBillWoodruff30-Nov-19 23:16 
GeneralCcc answer Pin
The pompey30-Nov-19 0:46
The pompey30-Nov-19 0:46 
GeneralRe: Ccc answer Pin
OriginalGriff30-Nov-19 1:28
mveOriginalGriff30-Nov-19 1:28 
GeneralThought of the Day Pin
OriginalGriff29-Nov-19 4:39
mveOriginalGriff29-Nov-19 4:39 
GeneralRe: Thought of the Day Pin
Peter_in_278029-Nov-19 4:52
professionalPeter_in_278029-Nov-19 4:52 
GeneralRe: Thought of the Day Pin
Mike Hankey29-Nov-19 4:59
mveMike Hankey29-Nov-19 4:59 
AnswerRe: Thought of the Day Pin
lopatir29-Nov-19 5:52
lopatir29-Nov-19 5:52 
GeneralRe: Thought of the Day Pin
Duncan Edwards Jones29-Nov-19 6:10
professionalDuncan Edwards Jones29-Nov-19 6:10 
GeneralRe: Thought of the Day Pin
Ravi Bhavnani29-Nov-19 6:33
professionalRavi Bhavnani29-Nov-19 6:33 
GeneralRe: Thought of the Day Pin
DRHuff29-Nov-19 7:13
DRHuff29-Nov-19 7:13 
GeneralRe: Thought of the Day Pin
Eddy Vluggen29-Nov-19 7:37
professionalEddy Vluggen29-Nov-19 7:37 

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.