Click here to Skip to main content
14,422,877 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 15:27
mveRick York30-Nov-19 15:27 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
honey the codewitch30-Nov-19 15:28
mvahoney the codewitch30-Nov-19 15:28 
GeneralRe: It's alive! (Don't you love that feeling?) Pin
Marc Clifton1-Dec-19 13:14
communityengineerMarc Clifton1-Dec-19 13:14 
QuestionInfo on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 4:30
MemberCp-Coder30-Nov-19 4:30 
AnswerRe: Info on tests mentioning manufacturer's name and product Pin
OriginalGriff30-Nov-19 4:36
communityengineerOriginalGriff30-Nov-19 4:36 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Cp-Coder30-Nov-19 4:39
MemberCp-Coder30-Nov-19 4:39 
GeneralRe: Info on tests mentioning manufacturer's name and product Pin
Nelek30-Nov-19 10:52
protectorNelek30-Nov-19 10:52 
GeneralI love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 2:00
mvahoney the codewitch30-Nov-19 2: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 5:07
professionalGreg Utas30-Nov-19 5:07 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 5:13
mvahoney the codewitch30-Nov-19 5:13 
PraiseRe: I love getting the garbage collector to do my other chores too Pin
0x01AA30-Nov-19 6:36
professional0x01AA30-Nov-19 6:36 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 6:44
mvahoney the codewitch30-Nov-19 6:44 
PraiseRe: I love getting the garbage collector to do my other chores too Pin
Daniel Pfeffer30-Nov-19 9:13
professionalDaniel Pfeffer30-Nov-19 9:13 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
honey the codewitch30-Nov-19 9:21
mvahoney the codewitch30-Nov-19 9:21 
GeneralRe: I love getting the garbage collector to do my other chores too Pin
BillWoodruff1-Dec-19 0:16
mveBillWoodruff1-Dec-19 0:16 
GeneralCcc answer Pin
Pompey 330-Nov-19 1:46
MemberPompey 330-Nov-19 1:46 
GeneralRe: Ccc answer Pin
OriginalGriff30-Nov-19 2:28
communityengineerOriginalGriff30-Nov-19 2:28 
GeneralThought of the Day Pin
OriginalGriff29-Nov-19 5:39
communityengineerOriginalGriff29-Nov-19 5:39 
GeneralRe: Thought of the Day Pin
Peter_in_278029-Nov-19 5:52
professionalPeter_in_278029-Nov-19 5:52 
GeneralRe: Thought of the Day Pin
Mike Hankey29-Nov-19 5:59
professionalMike Hankey29-Nov-19 5:59 
AnswerRe: Thought of the Day Pin
lopatir29-Nov-19 6:52
Memberlopatir29-Nov-19 6:52 
GeneralRe: Thought of the Day Pin
Duncan Edwards Jones29-Nov-19 7:10
professionalDuncan Edwards Jones29-Nov-19 7:10 
GeneralRe: Thought of the Day Pin
Ravi Bhavnani29-Nov-19 7:33
professionalRavi Bhavnani29-Nov-19 7:33 
GeneralRe: Thought of the Day Pin
DRHuff29-Nov-19 8:13
MemberDRHuff29-Nov-19 8:13 
GeneralRe: Thought of the Day Pin
Eddy Vluggen29-Nov-19 8:37
mveEddy Vluggen29-Nov-19 8: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.