Author Topic: Refactoring  (Read 6544 times)

0 Members and 1 Guest are viewing this topic.

mcarson

  • Guest
Re: Refactoring
« Reply #15 on: January 15, 2009, 04:14:34 PM »
Thanks TonyT, exactly the kind of response I am looking for - an example of what has been done in the past.
Sorry sinc, I was in agreement with much of what you said. Just attempting to convey the issues.
Daniel - I have noticed that loading assemblies on demand can be annoyingly slow

Stuck between a rock and a hard place!

GlennR - thanks for the pointer. I am implementing the same concept with linking the drawings in AutoCAD with Projects in a MSSQL database. 'Lazy loading': phrase for future reference!

I'll have another look at the code I have (I do have a large number of reusable methods, perhaps too many overloads!) and look at separating the AutoCAD Entity code, i.e. the code that accesses Autodesk.AutoCAD.DatabaseServices into a different assembly than the Sql database code.
After this it may be a good idea to create additional assemblies for each discipline, which reference the AutoCAD Entity code assembly.

So 5 assemblies so far.

LayerControl and ProjectControl, I suppose could go in one assembly since this code is for company standards helpers.

6 assemblies. I'll autoload them all until I research performance issues that do occur.

Thanks guys, I needed a push in the right direction.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2142
  • class keyThumper<T>:ILazy<T>
Re: Refactoring
« Reply #16 on: January 15, 2009, 05:08:34 PM »
< ...> So 5 assemblies so far.

LayerControl and ProjectControl, I suppose could go in one assembly since this code is for company standards helpers.

6 assemblies. I'll autoload them all until I research performance issues that do occur.

Do you mean Autoload  (Demand load) or load at startup.

I'm loath to load much at startup that will slow down things like scripted material extraction, batch plotting, or simple viewing of a drawing (read only or otherwise)
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

TonyT

  • Guest
Re: Refactoring
« Reply #17 on: January 15, 2009, 11:17:46 PM »

I have noticed that loading assemblies on demand can be annoyingly slow


All assemblies are loaded on demand. They are not loaded any other way,
unless you explicitly load them using Assembly.Load()/LoadFrom().

Assemblies referenced by a loaded assembly will not necessarily be loaded
until the code running in the referencing assembly references something in
the referenced assembly.

So, your comment leaves me scratching my head, because allowing
the framework to do what it is supposed to do, should not be annoyingly
slow, if you consider how much longer you would have to wait, if you
were to explicitly load every assembly that would otherwise be loaded
on demand.

The only issue with demand loading, is that it can occur at any time,
including during user interaction, which can result in a noticable delay
on a slower system (an example of that is AutoCAD 2009's WPF tooltips).

« Last Edit: January 15, 2009, 11:20:59 PM by TonyT »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Refactoring
« Reply #18 on: January 16, 2009, 11:13:23 PM »

not completely unrelated ..

http://blogs.msdn.com/ericlippert/archive/2009/01/16/future-proofing-a-design.aspx

Fabulous Adventures In Coding
Eric Lippert's Blog
Future-Proofing A Design
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.