richard parker ://brainthings.files.wordpress.com/2011/07/... · richard parker (twitter: @rikp)...
TRANSCRIPT
![Page 1: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/1.jpg)
Richard Parker http://blog.richard.parker.name
![Page 2: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/2.jpg)
Richard Parker (twitter: @rikp)
.NET developer
Specialising in web apps + cloud
Love tech!
![Page 3: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/3.jpg)
.NET Framework (from 20,000ft)
Why do we have it?
What problems does it try to solve?
What does the architecture look like?
Demos Q&A
![Page 4: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/4.jpg)
System Programmers
Low Level
Speed, Performance
Application Programmers
Result Oriented
Not concerned with environment
C/C++
![Page 5: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/5.jpg)
Code …
had to target a specific environment
wasn’t re-usable across platforms
errors could easily crash the system
Plus …
Writing code to target different platforms = tough
Very repetitive
![Page 6: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/6.jpg)
.NET Framework
Console
WinForms
Windows Services
ASP.NET Applications
ASP.NET Web
Services
Mobile Applications
(WP7 etc)
Silverlight
![Page 7: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/7.jpg)
Consistent OOP environment Environment must:
Minimise deployment and version conflicts
Promote safe execution of code
Eliminate performance issues of interpreted/scripted environments
Provide consistent experience across widely varying types of applications (Web/Win/Mob)
Be based on industry comm. standards
![Page 8: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/8.jpg)
I/O Devices, Memory, CPU
System (O/S)
Common Type System
Common Language Runtime
Class Library
![Page 9: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/9.jpg)
Source Code
• C#, VB.NET…
CIL
• Common Intermediate Language
Native
• JIT compilation
CIL code is interchangeable
Networking
Security
I/O
Web
![Page 10: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/10.jpg)
Compile once, run on any CPU or O/S Manages
Code at execution time
Memory and threads
Garbage collection (more on this later)
Enforces type safety
![Page 11: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/11.jpg)
C#, VB.NET
F#, J#, C++, [ … ]
LOLCODE HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
![Page 12: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/12.jpg)
Many language choices
Compiled into CIL
All running on the CLR
CLR manages memory, threads etc.
CLR is CPU independent
![Page 13: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/13.jpg)
A look at the roles and responsibilities of the CTS
![Page 14: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/14.jpg)
How types are represented in memory Cross-language integration
Defines rules to be followed by languages
Rules defining type inheritance
Rules for object lifetime
![Page 15: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/15.jpg)
Two types of type! Reference types
The value is a reference to another memory block containing the data
Object, String
Value types
The value is the data
Int, bool
![Page 16: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/16.jpg)
Everything is either a VALUE
or a REFERENCE
type
![Page 17: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/17.jpg)
Two types of memory
Stack (Value Types)
▪ Instance variables
▪ LIFO – think boxes stacked atop one another
▪ Static; i.e. primitive values live here
▪ The data is the value
Heap (Reference Types)
▪ Dynamic; i.e. complex types (objects)
▪ Pointers to other memory areas stored here
▪ Reference pointers allocated on the stack, though.
![Page 18: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/18.jpg)
Stack
• Values
• Boxing
Heap
• References
• Unboxing
![Page 19: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/19.jpg)
Demo #1 Boxing and Unboxing Speed Comparison
![Page 20: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/20.jpg)
Stack data is de-allocated from memory sequentially, but:
Memory on the heap is not automatically de-allocated
It waits for the Garbage Collector
This can cause problems
But mostly – it’s fire and forget!
![Page 21: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/21.jpg)
Manages allocation and release of memory Space not infinite! The GC must ‘collect’ in order to free memory Self-optimising
![Page 22: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/22.jpg)
![Page 23: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/23.jpg)
It’s boring and complicated Efficiently allocates objects on managed heap Reclaims unused objects for you Memory safety – objects cannot use content
of another object
![Page 24: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/24.jpg)
Demo #2 Application Memory and Garbage Collection
![Page 25: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/25.jpg)
Fundamental concepts you’ll need when starting your journey into the world of the .NET Framework
![Page 26: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/26.jpg)
Namespaces are collections of objects and other namespaces
Logical containers Dot syntax denoting hierarchy
System.Web.UI is in the System.Web namespace, which is in the System namespace.
![Page 27: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/27.jpg)
Base class – root of type hierarchy Derivation is implicit Common base methods:
Finalize()
GetType()
ToString()
Derived classes can and do override some of these base methods, like Equals().
![Page 28: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/28.jpg)
The CLR allows code re-use between projects targeting different platforms
Code is organised into projects which can be grouped into solutions
![Page 29: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/29.jpg)
Demo #3 Sharing Code Between Projects
![Page 30: Richard Parker ://brainthings.files.wordpress.com/2011/07/... · Richard Parker (twitter: @rikp) .NET developer Specialising in web apps + cloud Love tech! .NET Framework (from 20,000ft)](https://reader030.vdocuments.mx/reader030/viewer/2022041016/5ec7a4b83459f8638a5ff4a2/html5/thumbnails/30.jpg)