Showing posts with label Level 02: Intermediate Questions. Show all posts
Showing posts with label Level 02: Intermediate Questions. Show all posts

Monday, 7 May 2018

What are Portable Class Libraries?

Purpose:
  • This is a reasonable test to see if someone has any experience with the older strategies of portability in the .NET framework.
  • This perhaps does not not tell you much about a candidate since they could simply never have had a need to play with portability. But it is a good sign if someone has some experience in this domain.

Potential Answer:
PCLs allow for code sharing across platforms. They became very well known with frameworks like Xamarin and Silverlight originally. Although PCLs are supported in the .Net development environment, the defacto position at this stage of the game is that developers should support netstandard instead. The .NET Platform Standard is an evolution of PCLs and represents binary portability across platforms.

What are the 'async' and 'await' keywords for?

Purpose:
  • This question tests whether a developer has worked with multi threading. This is usually a good indicator for experience that a developer has written applications more complicated that run of the mill.

Potential Answers:
Async and await are language keywords that generate intermediate language that will free up the current thread for long running awaited calls. This is typically used for scenarios where a thread may make out of process calls and may be tied waiting for a response for example when you call a database or a service. Modern infrastructure is multi cored and this allows for more effective utilization of computing resources improving overall system performance.

Shared Framework vs. Self Contained Apps

Purpose:
  • This tests whether a developer has had exposure to .NET Core and has kept abreast with the latest developments.
  • It is also an indicator of whether the developer has any containerization experience.

Potential Answer:
Containerization has largely driven the entire need for .NET Core. AS such there are two models that are supported by the framework. The shared framework model is when mutliple apps on the same machine share the same installation of the framework that by default resides at 'c:\Program Files\dotnet'. Alternatively your app can be self contained with its own copy of the .NET core framework.

Where is .NET on disk?

Purpose:
  • Basic question that implicitly tests whether someone has had to grapple with .Net versions incongruities in environments.
  • Bonus points if the person knows that Net Core is located somewhere else and mentions self contained applications

Potential Answer:
.NET Framework = C:\Windows\Microsoft.NET 
.NET Core = C:\Program Files\dotnet

For .Net Core there are two ways to deploy, FDD (Framework-dependent) and SCD (Self-contained). 

SCD will resul in larger exe and means that it is your job to keep the .Net version up to date and to specify the plarforms that you target.

Thursday, 3 May 2018

What is a design pattern?

Purpose:
  • Familiarity with design patterns are a great indication that someone has a good theoretical understanding of the software industry.
  • It is usually a good indicator for passion and whether a developer cares about formalizing and mastering their craft.
  • Design pattern ignorance may show a general lack of interest in mastering their craft and suggest perhaps a code-by-google fashioned recipe coder that lacks an in depth reasoning of their designs.

Potential Answer:
As software development matured as an engineering field it was identified that like other engineering fields there are recurring problems and solutions that present themselves. So like other engineering fields software practitioners started formalizing so called design patterns. A design pattern provides low level solution (implementation) for the commonly occurring object oriented problem.

That is design patterns suggest a specific implementation for the specific object oriented programming problem. For example, if you want create a class that can only have one object at a time then you can use Singleton design pattern which suggests the best way to create a class that can only have one object.

What would be good to talk about is the fact that design patterns provide software practitioners with a common vocabulary to talk about software construction and design.

What is JIT compilation?

Purpose:

  • This question prods whether the developer has a proper grasp of the .NET framework and is familiar with terms that surround it's implementation.
  • Familiarity with .Net constructs are a good sign that a developer knows what he/she is doing, a but its a better warning sign if a developer falters on these types of questions.

Potential Answer:
JIT refers to Just in Time Compiler and is part of the Common Language Runtime (CLR). It manages the execution of all .NET programs and takes Intermediary Language and compiles it for running as native code/instructions.

What is IL?

Purpose:
  • This question prods whether the developer has a proper grasp of the .NET framework and is familiar with terms that surround it's implementation.
  • Familiarity with .Net constructs are a good sign that a developer knows what he/she is doing, a but its a better warning sign if a developer falters on these types of questions.

Potential Answer:
Intermediate language (IL) is the product of compilation from the higher level languages like C# and Visual basic into a special purpose object-oriented programming language designed to be used by compilers for the .NET Framework before static or dynamic compilation to machine code. (It is the product of compilation of your C# code into IL that then JIT compiles into Machine code)

Wednesday, 2 May 2018

What do we mean by managed code?

Purpose:
  • This question prods whether the developer has a proper grasp of the .NET framework and is familiar with terms that surround it's implementation.
  • Familiarity with .Net constructs are a good sign that a developer knows what he/she is doing, a but its a better warning sign if a developer falters on these types of questions.

Potential Answer:
Managed code is a term that was coined by Microsoft and it is simply the computer program code that requires and will execute only under the management of a Common Language Runtime virtual machine (that is the .NET Framework, or maybe a runtime like Mono).

Explain how Garbage Collection works?

Purpose:
  • Garbage collection is a goto topic for many technical interviewers since it easily illustrates the depth of understanding of the candidate regarding the framework.
  • The question is open ended in order to see how much detail a interviewee will go into.
Scott actually points people to a great resource that explains GC really well.

Potential Answer:
.NET uses garbage collection to provide automatic memory management for programs. The GC operates on a lazy approach to memory management, preferring application throughput to the immediate collection of memory.
  • Each process has its own, separate virtual address space. All processes on the same computer share the same physical memory, and share the page file if there is one.
  • By default, on 32-bit computers, each process has a 2-GB user-mode virtual address space.
  • As an application developer, you work only with virtual address space and never manipulate physical memory directly. The garbage collector allocates and frees virtual memory for you on the managed heap.
  • If you are writing native code, you use Win32 functions to work with the virtual address space. These functions allocate and free virtual memory for you on native heaps.
  • Virtual memory can be in three states:
    • Free. The block of memory has no references to it and is available for allocation.
    • Reserved. The block of memory is available for your use and cannot be used for any other allocation request. However, you cannot store data to this memory block until it is committed.
    • Committed. The block of memory is assigned to physical storage.
  • Virtual address space can get fragmented. This means that there are free blocks, also known as holes, in the address space. When a virtual memory allocation is requested, the virtual memory manager has to find a single free block that is large enough to satisfy that allocation request. Even if you have 2 GB of free space, the allocation that requires 2 GB will be unsuccessful unless all of that free space is in a single address block.
  • You can run out of memory if you run out of virtual address space to reserve or physical space to commit.
Garbage collection occurs when one of the following conditions is true:
  • The system has low physical memory. This is detected by either the low memory notification from the OS or low memory indicated by the host
  • The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This threshold is continuously adjusted as the process runs.
  • The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.
The heap is organized into generations so it can handle long-lived and short-lived objects. Garbage collection primarily occurs with the reclamation of short-lived objects that typically occupy only a small part of the heap. There are three generations of objects on the heap:
  • Generation 0. This is the youngest generation and contains short-lived objects. An example of a short-lived object is a temporary variable. Garbage collection occurs most frequently in this generation.

    Newly allocated objects form a new generation of objects and are implicitly generation 0 collections, unless they are large objects, in which case they go on the large object heap in a generation 2 collection.

    Most objects are reclaimed for garbage collection in generation 0 and do not survive to the next generation.
  • Generation 1. This generation contains short-lived objects and serves as a buffer between short-lived objects and long-lived objects.
  • Generation 2. This generation contains long-lived objects. An example of a long-lived object is an object in a server application that contains static data that is live for the duration of the process.
Garbage collections occur on specific generations as conditions warrant. Collecting a generation means collecting objects in that generation and all its younger generations. A generation 2 garbage collection is also known as a full garbage collection, because it reclaims all objects in all generations (that is, all objects in the managed heap).

Objects that are not reclaimed in a garbage collection are known as survivors, and are promoted to the next generation. Objects that survive a generation 0 garbage collection are promoted to generation 1; objects that survive a generation 1 garbage collection are promoted to generation 2; and objects that survive a generation 2 garbage collection remain in generation 2.

When the garbage collector detects that the survival rate is high in a generation, it increases the threshold of allocations for that generation, so the next collection gets a substantial size of reclaimed memory. The CLR continually balances two priorities: not letting an application's working set get too big and not letting the garbage collection take too much time.

What is Roslyn?

Purpose:
  • This question prods whether a developer has a working understanding of how the .Net framework sticks together under the hood.
  • Knowledge of the internals of the framework indicate a passion for craft.

Potential Answer:
Roslyn was the code name for the .Net Compiler platform. It is a set of open-source compilers for C# and Visual Basic. Unlike traditional compilers Roslyn exposes an api layer that allows for rich code analysis to be done.

What is CoreFX?

Purpose:
  • Unlike the original CLR, the core CLR tries to be as lean as possible. As such the .Net Class libraries are actually contained in the CoreFX. This question prods the depth of the candidate's knowledge about .Net framework developments.

Potential Answer:
The CoreCLR package is actually not very useful on its own. The reason for this is because the CoreCLR package tries to minimize the amount of the class library that it implements. Only types that have a strong dependency on the internal workings of the runtime are included (e.g, System.Object, System.String, System.Threading.Thread, System.Threading.Tasks.Task and most foundational interfaces). 

For the more familiar classes and libraries (System.Collections, System.IO, System.Xml and so on)  are implemented as independent NuGet packages that simply use the .NET Core runtime as a dependency.

Tuesday, 1 May 2018

What is the CoreCLR?

Purpose:
  • This once again tests whether a developer has kept abreast with the evolution of the .Net framework.
  • A knowledge of the design goals surrounding CoreCLR and how it differs to the normal CLR will certainly show passion

Potential Answer:
Similar answer to the CLR will do.

The key differentiation here is that .Net Core code runs on a different runtime to the Full.Net (CLR).

A really good indication would be if the candidate starts talking about the realtionship between CoreCLR and CoreFX and how the CoreCLR tries to minimize as much the class libraries that is implemented to make it more portable and agile.

Monday, 16 June 2014

What is the CLR?

Purpose:
  • If a developer is ignorant of how the .Net framework actually sticks together it means they potentially don't care enough about their craft to understand the nuts and bolts of how things work, this means that they will be a code-by-google kind of developer that will not be a great investment.

Potential Answer:
.Net Framework provides runtime environment called Common Language Runtime (CLR).It provides an environment to run all the .Net Programs. The code which runs under the CLR is called Managed Code since it is not native code, but an intermediate language called MSIL (Microsoft Intermediate Language). Programmers need not to worry on managing the memory if the programs are running under the CLR as it provides memory management, security and thread management.

Programmatically, when our program needs memory, the CLR allocates the memory for scope and de-allocates the memory if the scope is completed.

Language Compilers (e.g. C#, VB.Net, J#) will convert the Code/Program to Microsoft Intermediate Language(MSIL) using the Common Type System (CTS) and the rules of the Common Language Specification (CLS). This MSIL code is then converted on a Just-in-time compiler to Native Code by the CLR.

Friday, 27 July 2012

When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

Purpose:
  • There was a time where the gold standard for deployment was IIS. This tests whether a developer has a working understanding of the thread model of IIS. This is important for security management and also debugging and performance tuning.
  • It shows that a developer has at least worked with deploying websites in a windows ecosystem.

Potential Answer:
The component is assigned to an application pool that runs on a worker process For IIS 5 - That ships with XP and 2000 - it is the ASPnet_wp.exe which is called the ASP worker process. For IIS 6 & IIS 7 - Which is 2003 and up - IIS 7 with Server 2008, the process to look out for is W3WP.exe

What is the difference between in-proc and out-of-proc? What technology enables out-of-proc communication in .NET?

Purpose:
  • Remoting as a topic is rather old and as such a question like this could illustrate the depth of experience or a good understanding of how distributed software development has evolved over the years.
  • A discussion of the performance penalty of marshalling and going out-of-process would be a good sign.

Potential Answer:
This is referring to .Net Remoting which allows for method invocation across application domains. It provides an abstract approach to inter-process communication. in-proc is when you are in the same application domain and is faster since out-of-proc requires marshalling and serialization between the two process boundaries.

Friday, 6 July 2012

What does this useful command line do? tasklist /m "mscor*"

Purpose:
  • An experienced developer would at some stage have gone into the developer command prompt to get something done. Chances are good that it may have been due to dll hell being wrecked on them. Or perhaps it could be part of setting up and Continuous delivery pipeline. Whatever it it is knowledge of these type of commands illustrates experience.

Potential Answer:
It will list all the processes that have loaded modules which start from the mscor libray hosted by the .net environment

How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

Purpose:
  • Even though .Net is a managed framework it does not abscond developers from having to understand how memory management works under the hood. Being able to explain the purpose behind the IDisposable interface and supporting language features to manipulate garbage collection is a mark of a professional developer.

Potential Answer:
The using pattern or keyword is a way to allow us to use an expensive object in a deterministic or predictable manner and ensure garbage collection is done after we are done using the resource. For objects that require such deterministic collections we may opt to implement the IDisposable interface to allow for non GC based collection being invoked..

What is the difference between Finalize() and Dispose()?

Purpose:
  • Even though .Net is a managed framework it does not abscond developers from having to understand how memory management works under the hood. Being able to explain the purpose behind the IDisposable interface and supporting language features to manipulate garbage collection is a mark of a professional developer.
  • Also there is well known best practice way of implementing IDisposable that requires the use of the Finalizer. Knowledge of these language constructs suggests that the developer has a good grasp of things.

Potential Answer:
The Finalize is non public and is called by the Garbage collector whereas the Dispose method can be invoked by the user which will cause the Garbage collector to invoke the finalize method.

How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

Purpose:
  • Even though .Net is a managed framework it does not abscond developers from having to understand how memory management works under the hood. Being able to explain the functioning of the garbage collector shows an in depth understanding of the framework under the covers.

Potential Answer:
Divided into three stages. One short lived and other two long term. It assumes new objects will have shorter lifespans that older objects. Non-deterministic finalization means that the finalizer will not immediate be invoked once the object goes out of scope since it is more effecient to reclaim the heap in sections that doing it on a per case basis.

What is the JIT? What is NGEN? What are limitations and benefits of each?

Purpose:
  • Tests whether a developer has an understanding of what happens under the hood of .Net Runtime.
  • Having knowledge of NGEN shows that a developer would have been involved with code optimization exercises in the past that is a promising sign for experience and skill.

Potential Answer:
Just-In-Time compilation produces MSIL (Microsoft Intermediate Language) the first time the assembly is called, it is compiled into CPU specific native code by the .NET JIT compiler.  to have a so called portable executable which in theory one can write once and run everywhere. JIT compiles the code and stores result native code in memory at initial call and subsequent calls is accessing in-memory native code hence it is relatively efficient.

NGEN is when code is pre-compiled or pre-JITted into native code which makes for faster startup times.