TOC Previous Next: Here Here Here Here
TOC Previous Next: Here Here Here Here
Why .NET?
.NET is a big, continuously evolving bundle of old and new Microsoft development
technologies. It continues to be used less with MySQL than, say, PHP, but in the world at
large it’s had more than 2 billion installations. Over six million developers use it.
Microsoft’s decision to make the technology open source and add cross-platform capa-
bilities has widened use. Version 4.8 wants a 2GHz processor or better, at least 0.5GB
RAM; 4.5GB disk space. Windows version requirements are summarised here. Main
.NET components you will need include the core downloadable here, the framework
downloadable here, and the deployment guide.downloadable here. Names and contents
of packages vary from version to version, over the years have included…
• the core, .NET Framework, implements HTTP, XML, SOAP (Simple Object
Access Protocol), DDEX (Data Designer Extensibility) and UDDI (Universal
Description Discovery and Integration). Multiple versions advance frequently;
• data handling classes bundled as ADO.NET (ActiveX Data Objects);
• Internet Information Services (IIS);
• a Common Language Runtime (CLR), a virtual machine for executing code
compiled from various languages (analogous, and not accidentally, to the Java
Virtual Machine);
• ODBC.NET, a wrapper for ODBC drivers;
• Microsoft SQL Server;
• ASP.NET (Active Server Pages .NET) for developing web applications using
VBScript, JScript, Perlscript, Python, Visual Basic, C#, C, Cobol, and even Lisp
or Smalltalk;
• Visual Basic .NET;
• Visual Studio: an elegant application development environment incorporating all
the above, with a new free Community edition and commercial versions costing
up to $12,000 US;
• Visual Studio Code, a code editor, successor to the now discontinued Web Matrix;
• Visual Basic, C#, C++, J++, WebDeveloper and Visual Studio Community
(formerly Express) Editions.
But …
That flexibility, robustness and marketing will cost you computing power, efficiency,
freedom, modularity, installation issues and security
About the computing power: It runs in .5G but serious use requires a fast processor and
several GB of RAM. The more computing power you throw at Visual Studio, the happier
you will be.
About efficiency: The magic of .NET database interoperability comes from an XML layer
between code and data source. That mapping costs you CPU cycles, memory and time.
So does the huge .NET class hierarchy. ASP and ODBC impose additional length on
code paths, are memory-hungry, and execute slowly—serious problems for web
applications and their servers.
And if you are considering ODBC, there is the double-edged question of database
independence. If application code is free of specifics tying it to a particular RDBMS, the
database backend can be swapped out like a battery in a car. Isn't that a terrific
advantage? Yes and no. Yes to the extent that the application's SQL scripts are limited to
entirely portable, vanilla code. No to a similar extent, since the degree to which the SQL
code is generic is the degree to which the code fails to take advantage of optimisations
.NET architecture
Windows and Java are the two most popular programming environments on the planet.
Java enjoys three advantages: it is object-oriented bottom to top, it manages code to
prevent dangling pointers and similar errors, and it runs on any machine that runs a Java
Virtual Machine (JVM), regardless of operating system.
.NET is a Microsoft response to Java, meant to provide for Windows what Java provides
for a Java-enabled operating system, plus language neutrality—you do not need to learn
one particular language, and you should be able to port much Windows code to .NET
without a lot of rewrites.
.NET Framework interfaces inherit multiply, its objects inherit singly. There is support
for events and properties. A fundamental concept is the namespace—a collection of
classes, interfaces, enumerations, and delegates. The root object is System.Object. The
Common Type System (CTS) defines basic value types, type composition and safety,
classes, interfaces and delegation. The Common Language Specification (CLS) is a
subset of CTS with which .NET languages comply. Microsoft has promised that all future
APIs will comply with CLS.
The Common Intermediate Language (CIL) is the intermediate code to which all .NET
languages compile in executables called assemblies, which are DLLs or EXEs having a
header that indicates the presence of CIL code and .NET metadata. The Common
Language Runtime (CLR), written in C++, includes the CTS, the garbage collector,
exception handlers, and a module which just-in-time-compiles assembly CIL byte codes
to native object code.
The Framework Class Library (FCL) is the .NET runtime library. No more Win32 API,
which no-one will miss. Of particular interest to MySQL developers are .NET
Framework database and .NET web classes. Database classes inherit from System.Data
and implement ADO.NET. There are three DataProvider groups: System.Data.Odbc,
System.Data.OleDb, and direct data providers. Web classes inherit from System.Web,
and implement ASP.NET.
For database applications, data modelling in the development tool is crucial. The core
.NET data model is in the System.Data namespace, structuring classes for data source
connection, query submission, data manipulation, and result processing. It serves as a
hierarchical data cache, serviceable online and offline.
To read the rest of this and other chapters, buy a copy of the book