C++/CLI versus Access VBA: A side by side comparison between C++/CLI and Access VBA.
C++/CLI
This content is based on C++/CLI (C++ for the .Net Framework) and all code was tested in VS.Net 2008 using the various CLR project templates for .Net. The CLI stands for Common Language Infrastructure.
Access VBA
Version: This content is based on Microsoft Access 2003.
This content focuses on topics in common among the languages documented here so this content most likely applies to Access 2007 as well as earlier versions such as Access 97, 2000, and 2002.
In addition, much of the Access information presented here is in common with ASP Classic (with some notable differences) and VB Classic (very closely). Finally, the syntax for VB.Net is based on VB so some of it even applies to VB.Net.
Tool Basics
Developer environment basics such as common file extensions, common keyboard shortcuts, etc.
Built-In: Some development tools have a reporting tool built-in and some do not. For example, typically desktop databases such as Paradox and Access have a built-in reporting tool and typically that reporting tool is used with nearly every application built with it. A built-in reporting tool makes development of reports across many clients and applications consistent and therefore easy.
Add-On: Development tools that do not have a built-in reporting tool need to use either a currently bundled report writer, or one of the popular reporting tools that integrates well with the development tool. For example, popular reporting tools include Crystal Reports, ReportBuilder, and MS SQL Reporting Services (tied to MS SQL).
Language Basics
Language basics is kind of a catch all for absolute beginner stuff. The items (common names) I chose for language basics is a bit random and include items like case sensitivity, commenting, declaring variables, etc.
Case sensitiviy in this case is referring to commands and variable names. For example, are "printf" and "PrintF" equivalent? Are fullname and FullName equivalent? When you create commands, operations, methods, or variables should you worry about case?
Commenting code generally has three purposes: to document your code, for psuedo coding prior to coding, and to embed compiler directives. Most languages support both a single line comment and a multiple line comment. Some languages also use comments to give instructions to the compiler or interpreter.
In coding languages, common End of statement specifiers include a semicolon and return (others exist too). Also of concern when studying a language is can you put two statements on a single code line and can you break a single statement into two or more code lines.
A value directly written into the source code of a computer program (as opposed to an identifier like a variable or constant). Literals cannot be changed. Common types of literals include string literals, floating point literals, integer literals, and hexidemal literals. Literal strings are usually either quoted (") or use an apostrophe (') which is often referred to as a single quote. Sometimes quotes are inaccurately referred to as double quotes.
Languages Focus
In addition to understanding whether to use a quote or apostrophe for string literals, you also want to know how to specify and work with other types of literals including floating point literals. Some compilers allow leading and trailing decimals (.1 + .1), while some require a leading or trailing 0 as in (0.1 + 0.1). Also, because floating point literals are difficult for compilers to represent accurately, you need to understand how the compiler handles them and how to use rounding and trimming commands correctly for the nature of the project your are coding.
A variable holds a value that you can use and change throughout your code so long as the variable is within scope. With variable declaration, you not only want to know the syntax of how you declare a variable but you also want to know where. Are you allowed to declare a variable inline? What are the available scopes: local vs. global. Can you assign a value at the same time you declare a variable?
Language Details
Language Details is kind of a catch all for stuff that didn't make it into language basics nor any other category.
For non-OOP languages, a custom routine is a function, procedure, or subroutine and for pure OOP languages, a custom routine is a class method. Hybrid languages (both non-OOP and OOP) combine both.
Also known as embedded code where you embed another syntax language within the native code of the development environment you are using. The inline code can be compiled by the current development's compiler or by an external compiler.
Do not confuse with inlining which is a coding technique where custom routines are moved inline where the code is executed either by you, by a compiler directive, or automatically by the compiler.
Instead of calling a routine, you move the code from the routine itself and expand it in place of the call. In addition to manual inlining, some languages support automatic inlining where the compiler or some other pre-compiler decides when to inline a code routine. Also, some languages allow for developer defined inlining where the developer can suggest and/or force the inlining of a code routine. Inlining can optimize your code for speed by saving a call and return, and parameter management.
Languages Focus
Does it support inlining? If so, does it support developer defined inlining? Does it support automatic inlining? Both?
Types of overloading include method overloading and operator overloading.
Method Overloading is where different functions with the same name are invoked based on the data types of the parameters passed or the number of parameters. Method overloading is a type of polymorphism and is also known as Parametric Polymorphism.
Operater Overloading allows an operator to behave differently based on the types of values used. For example, in some languages the + operator is used both to add numbers and to concatenate strings. Custom operator overloading is sometimes referred to as ad-hoc polymorphism.
A data structure in which individual values (called elements or items) may be located by reference to one or more integer index variables, the number of such indices being the number of dimensions in the array.
Arrays can start with an index value of 0 or 1, sometimes referred to as 0 based or 1 based.
A set of unique keys linked to a set of values. Each unique key is associated with a value. Think of it as a two column table.
MyArray['CA'] = 'California'
MyArray['AR'] = 'Arizona'
Languages Focus
Associative arrays are also known as a dictionary or a hash table in other languages.
A pointer is a variable type that allows you to refer indirectly to another object. Instead of holding data, a pointer holds the address to data -- the address of another variable or object. You can change the address value a pointer points to thus changing the variable or object the pointer is pointing to.
A reference is a type of pointer that cannot change and it must always point to a valid storage (no nulls).
[Not specified yet. Coming...]
Statements
Common statements such as if statements, loops, etc.
Common assignment operators for languages include =, ==, and :=. An assignment operator allows you to assign a value to a variable. The value can be a literal value like "Mike" or 42 or the value stored in another variable or returned by a function.
When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.
Languages Focus
A comparison operator compares two values either literals as in "Hello" and 3 or variables as in X and Counter. Most languages use the same operators for comparing both numbers and strings. Perl, for example, uses separate sets of comparison operators for numbers and strings.
An empty string is a zero length string, a string that is equal to null (""), or not assigned. In some languages, you can check if a string is empty by comparing it to an empty string (""). Some languages distinguish between nil and null ("") so checking if the length is 0 is easier.
Logical operators perform conditional and, or, and not operations. Some languages support both binary logical operators that link two and unary logical operators negate (make opposite) the truth value of its argument. Finally, some languages short circuit logic. For example, with this or that, if this is an expression returning true, then that is never executed.
An operation with only one operand (a single input). Common unary operators include + plus, - minus, and bitwise not. Some operators can function as both unary and binary operators. For example, + and - operators can serve as either.
Languages Focus
What unary operators are supported in additoin to the standard plus, minus, and bitwise not.
[Not specified yet. Coming...]
Commands
Common commands (procedures and functions). A function returns a value. Optionally, it may also perform an action prior to returning a value. A procedure does not return a value or it returns void or null.
Some languages support object-based concepts such as Paradox, Access, and VB Classic. Other languages have OO extensions and fully support object orientation in a hybrid fashion (such as C++ and Dephi for Win32). Finally, some lanages such as C#, VB.Net, Prism, and Java are entirely written in OO. Meaning, every line of code written must occur within a class).
When you create a class, it is either a base class or inherits from another class. Some languages require all classes to inherit from a common base class and some do not.
A code routine that belongs to the class or an object instance (an instance of the class). Methods that belong to the class are called class methods or static methods. Methods that belong to an object instance are called instance methods, or simply methods.
When a method returns a value, it is a function method. When no value is returned (or void), it is a procedure method.
Methods frequently use method parameters to transfer data. When one object instance calls another object instance using a method with parameters, you call that messaging.
A. In Dephi, class helpers allow you to extend a class without using inheritance. With a class helper, you do not have to create and use a new class descending from a class but instead you enhance the class directly and continue using it as you always have (even just with the DCU).
B. In general terms, developers sometimes use the term to refer to any class that helps out another class.
A contract with a method that must be true upon calling (pre) or exiting (post). A pre-condition contract must be true when the method is called. A post-condition contract must be true when exiting. If either are not true, an error is raised. For example, you can use code contracts to check for the validity of input parameters, and results
An invariant is also a code contract which validates the state of the object required by the method.
Constructors are called when you instantiate an object from a class. This is where you can initialize variables and put code you wish executed each time the class is created. When you initially set the member fields and properties of an object, you are initializing the state of the object. The state of an object is the values of all it's member fields and properties at a given time.
Languages Focus
What is the syntax? Can you overload constructors? Is a special method name reserved for constructors?
A special class method called when an object instance of a class is destroyed. With some languages they are called when the object instance goes out of scope, with some languages you specifically have to call the destructor in code to destroy the object, and others use a garbage collector to dispose of object instances at specific times.
Desctructors are commonly used to free the object instance but with languages that have a garbage collector object instances are disposed of when appropriate. Either way, destructors or their equivalent are commonly used to free up resources allocated in the class constructor.
Languages Focus
Are object instances freed with a garbage collector? Or, do you have to destroy object instances.
An element of coding where you define a common set of properties and methods for use with the design of two or more classes.
Both interfaces and abstract classes are types of abstraction. With interfaces, like abstract classes, you cannot provide any implementation. However, unlike abstract classes, interfaces are not based on inheritance. You can apply an Interface to any class in your class tree. In a real sense, interfaces are a technique for designing horizontally in a class hierarchy (as opposed to inheritance where you design vertically). Using interfaces in your class design allows your system to evolve without breaking existing code.
A partial class, or partial type, is a class that can be split into two or more source code files and/or two or more locations within the same source file. Each partial class is known as a class part or just a part. Logically, partial classes do not make any difference to the compiler. The compiler puts the class together at compile time and treats the final class or type as a single entity exactly the same as if all the source code was in a single location.
Languages Focus
For languages that have implemented partial classes, you need to know usage details and restrictions. Can you split a class into two or more files? Can you split a class within a source code file into two or more locations? What are the details of inheritance? Does it apply to interfaces as well?
A static member is a member you can have access to without instantiating the class into an object. For example, you can read and write static properties and call static methods without ever creating the class. Static members are also called class members (class methods, class properties, etc.) since they belong to the class and not to a specific object. A static class is a class that contains only static members. In the UML, these classes are described as utility classes.
Languages Focus
Languages that support static members usually at least support static member fields (the data). Some languages also support static methods, properties, etc. in which case the class member is held in memory at one location and shared with all objects. Finally, some languages support static classes which usually means the compiler will make sure a static class contains only static members.