VBA ≅ javascript on a webpage (Singletons)

Let’s focus on the typical use cases —

* A typical javascript app Operates on a DOM tree of the enclosing webpage.
* A typical VBA app operates on the EOM tree (Excel object model) of an attached workbook.

—-} In both scenarios, the programmer’s Main job is manipulation of the objects in the *OM. The *OM tree is essentially a big family of singletons. I’d say most GUI apps rely heavily on singletons even if you don’t like singletons.

Usually the VBA app is tailor made for that particular workbook. Tight coupling between the workbook and the VBA module. Javascript is similar.

simple VBA – copy sheets from Workbook A to B

Sub Btn_Click()
    Dim ws As Worksheet
    Dim targetWB, sourceWB As Workbook
    Set targetWB = ActiveWorkbook
    Workbooks.Open Filename:=Range(“B1”).Text, ReadOnly:=True
    Set sourceWB = ActiveWorkbook
    For Each ws In Worksheets
        ws.Copy After:=targetWB.Sheets(targetWB.Sheets.Count)
    Next ws
    sourceWB.Close SaveChanges:=False
End Sub

c# IV questions found online

I want to see some knowledge of things like the GAC, CLR and JIT. Here are some sample C#-specific questions: 
– Where are the framework assemblies stored? How is this useful? 
– Explain the abstract keyword and what is an example of its use? 
– Can you prevent a class from being inherited by another class? If so, how? 
Easy questions:
    * Is System.String a class or a struct (or reference or value type if you prefer).
    * Explain IDisposable and the 'using' statement.
    * Explain public, protected, private, and internal.
Intermediate questions:
    * What's the difference between Hashtable and Dictionary?
    * What does int? mean? Explain the relationship with Nullable.
Hard questions:
    * Explain the following snippet of code: 'from x in collection select new { x.Foo }'. What is the compiler doing? What is the CLR executing?
    * Explain the “yield” keyword. What is the compiler doing internally?
# What are Generics ? How do they affect performance.
# How would you define an Anonymous Functions? What is the difference between Anonymous Methods and Lambda Expressions?
# How does an Enumerator (IEnumerable & IEnumerator) work ? How does an Iterator work in C# 2.0 ?
# What is Garbage Collection ? How does it work ? What are generations in GC ?
# What is the role of an Extension Method ? When would you use it ?
# What is a Lambda Expression ? Where would you use it ?
# How would you define a new custom event ?
# How would you choose between a pure abstract base class and an interface.
# What is MVC how does it differ from MVP ?
# What is Dependency Injection / Inversion of Control ?
Everyone who writes code
    * Describe the difference between a Thread and a Process?
    * What is a Windows Service and how does its lifecycle differ from a “standard” EXE?
    * What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
    * What is the difference between an EXE and a DLL?
    * What is strong-typing versus weak-typing? Which is preferred? Why?
    * Corillian's product is a “Component Container.” Name at least 3 component containers that ship now with the Windows Server Family.
    * What is a PID? How is it useful when troubleshooting a system?
    * How many processes can listen on a single TCP/IP port?
    * What is the GAC? What problem does it solve?
Mid-Level .NET Developer
    * Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
    * Describe what an Interface is and how it’s different from a Class.
    * What is Reflection?
    * What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
    * Are the type system represented by XmlSchema and the CLS isomorphic?
    * Conceptually, what is the difference between early-binding and late-binding?
    * Is using Assembly.Load a static reference or dynamic reference?
    * When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?
    * What is an Asssembly Qualified Name? Is it a filename? How is it different?
    * Is this valid? Assembly.Load(“foo.dll”);
    * How is a strongly-named assembly different from one that isn’t strongly-named?
    * Can DateTimes be null?
    * What is the JIT? What is NGEN? What are limitations and benefits of each?
    * How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
    * What is the difference between Finalize() and Dispose()?
    * How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
    * What does this useful command line do? tasklist /m “mscor*”
    * What is the difference between in-proc and out-of-proc?
    * What technology enables out-of-proc communication in .NET?
    * When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?
Senior Developers/Architects
    * What’s wrong with a line like this? DateTime.Parse(myString);
    * What are PDBs? Where must they be located for debugging to work?
    * What is cyclomatic complexity and why is it important?
    * Write a standard lock() plus “double check” to create a critical section around a variable access.
    * What is FullTrust? Do GAC’ed assemblies have FullTrust?
    * What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
    * What does this do? gacutil /l | find /i “Corillian”
    * What does this do? sn -t foo.dll
    * What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
    * Contrast OOP and SOA. What are tenets of each?
    * How does the XmlSerializer work? What ACL permissions does a process using it require?
    * Why is catch(Exception) almost always a bad idea?
    * What is the difference between Debug.Write and Trace.Write? When should each be used?
    * What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
    * Does JITting occur per-assembly or per-method? How does this affect the working set?
    * Contrast the use of an abstract base class against an interface?
    * What is the difference between a.Equals(b) and a == b?
    * In the context of a comparison, what is object identity versus object equivalence?
    * How would one do a deep copy in .NET?
    * Explain current thinking around IClonable.
    * What is boxing?
    * Is string a value type or a reference type?
    * What is the significance of the “PropertySpecified” pattern used by the XmlSerializer? What problem does it attempt to solve?
    * Why are out parameters a bad idea in .NET? Are they?
    * Can attributes be placed on specific parameters to a method? Why is this useful?
C# Component Developers
    * Juxtapose the use of override with new. What is shadowing?
    * Explain the use of virtual, sealed, override, and abstract.
    * Explain the importance and use of each component of this string: Foo.Bar, Version=, Culture=neutral, PublicKeyToken=593777ae2d274679d
    * Explain the differences between public, protected, private and internal.
    * What benefit do you get from using a Primary Interop Assembly (PIA)?
    * By what mechanism does NUnit know what methods to test?
    * What is the difference between: catch(Exception e){throw e;} and catch(Exception e){throw;}
    * What is the difference between typeof(foo) and myFoo.GetType()?
    * Explain what’s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
    * What is this? Can this be used within a static method?

c++ questions w or w/out answers

Q: will a custom ctor suppress the default ctor generation?
Q: what if I declare but not implement my dtor?
Q: how to access a c++ api across network
Q: default behaviour of the less class-template
Q: how do you detect memory leak?
A: glowcode
%%A: customize op-new and op-delete to maintain counters?
Q: in java, i can bind a template type param — bound params. c++?
%%A: no
Q891: are assignment op usually marked const?
A: the defalult one yes.
Q891a: what if i override the default one with a non-const op=? will the default one still exist?
Q: is std::string immutable?
%A: no
Q: do people pass std::strings by ref? See Absolute C++
Q: unwrap a null ptr
A: behavior undefined
Q: delete a null ptr
A: C++ guarantees that operator delete checks its argument for null-ness. If the argument is 0, the delete expression has no effect.
Q: comparing null pointers?
A: In C and C++ programming, two null pointers are guaranteed to compare equal
Q: use a ref to a reclaimed address?
A: undefined. May crash.
Q: Add “template” keyword only when defining a func, not when calling it?
Q: can i declare a Vector to hold Integers and Floats? 
A: slicing. To get polymorphism, use ptr or ref.
Q: what op must NOT be overloaded as member func?
A: qq(<>) …
Q: op overloading looks more like overriding?
A: but overriding is only for methods!
Q: what if destructor is not virtual?
A: one of my books — [[nitty]] p104
Q: for a linked list or vector, can we put some elements on stack and others on heap?
Q: Can i declare an Insect variable to hold an Ant object, without using pointers? “Ant a; Insect i = a;”?
A: see P271 [[24]]
A: see post on slicing
Q: Without STL or malloc(), how does C handle large data structures. 
A: I used to deal with large amounts of data without malloc(). Global var, linked data structure, arrays