Using New Delphi Coding Styles and Architectures A Review of the Language Features in Delphi 2009
|
|
|
- Erika McCoy
- 10 years ago
- Views:
Transcription
1 Tech Notes Using New Delphi Coding Styles and Architectures A Review of the Language Features in Delphi 2009 Marco Cantù December 2008 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco, California York House 18 York Road Maidenhead, Berkshire SL6 1SF, United Kingdom L La Trobe Street Melbourne VIC 3000 Australia
2 INTRODUCTION: THE DELPHI LANGUAGE The Delphi language, better known as Object Pascal, is a modern strong -checked and object-oriented language, featuring single inheritance and an object reference model. In recent years, the language has been augmented with record with methods, operators overloading for records, class data, nested s, sealed classes, final methods and many other relevant features. The most surprising extension was probably the introduction of class helpers, a technique used to add new methods to an existing class or replace some of the existing methods. But in Delphi 2009 the new features added to the compiler are even more relevant. Besides the extensions to the string to support Unicode, the last version of Delphi introduces generic data s, anonymous methods, and a number of other minor but very interesting features. INTRODUCING GENERICS As a first example of a generic class, I've implemented a key-value pair data structure. The first code snippet below shows the data structure as it is traditionally written, with an object used to hold the value: TKeyValue = class private FKey: string; FValue: TObject; procedure SetKey(const Value: string); procedure SetValue(const Value: TObject); public property Key: string read FKey write SetKey; property Value: TObject read FValue write SetValue; To use this class you can create an object, set its key and value, and use it, shown in the following snippets: // FormCreate kv := TKeyValue.Create; // Button1Click kv.key := 'mykey'; kv.value := Sender; // Button2Click kv.value := self; // the form // Button3Click ShowMessage ('[' + kv.key + ',' + kv.value.classname + ']'); Embarcadero Technologies - 1 -
3 Generics make it possible to use a much broader definition for the value, but that's not the key point. What's totally different (as we'll see) is that once you've instantiated the key-value generic class, it becomes a specific class tied to a given data. This makes your code safer, but I'm getting ahead of myself. Let's start with the syntax used to define the generic class: TKeyValue<T> = class private FKey: string; FValue: T; procedure SetKey(const Value: string); procedure SetValue(const Value: T); public property Key: string read FKey write SetKey; property Value: T read FValue write SetValue; In this class definition, there is one unspecified that is indicated by the placeholder T. The generic TKeyValue<T> class uses the unspecified as the of the property value field and the setter method parameter. The methods are defined as usual; however, even though they have to do with the generic, their definition contains the complete name of the class, including the generic : procedure TKeyValue<T>.SetKey(const Value: string); FKey := Value; procedure TKeyValue<T>.SetValue(const Value: T); FValue := Value; To use the class, instead, you have to fully qualify it, providing the actual value of the generic. For example, you can now declare a key-value object hosting button as value by writing: kv: TKeyValue<TButton>; The full name is also required when creating an instance because this is the actual name (the generic, uninstantiated name is like a construction mechanism). Using a specific of the value for the key-value pair makes the code much more robust, as you can now only add TButton (or derived) objects to the key-value pair and can use the ious methods of the extracted object. These are some snippets: // FormCreate kv := TKeyValue<TButton>.Create; // Button1Click kv.key := 'mykey'; Embarcadero Technologies - 2 -
4 kv.value := Sender as TButton; // Button2Click kv.value := Sender as TButton; // was "self" // Button3Click ShowMessage ('[' + kv.key + ',' + kv.value.name + ']'); When assigning a generic object in the previous version of the code we could add either a button or a form. Now we can use only a button, a rule enforced by the compiler. Likewise, rather than a generic kv.value.classname in the output, we can use the component Name, or any other property of TButton. Of course, we can also mimic the original program by declaring the key-value pair as: kvo: TKeyValue<TObject>; In this version of the generic key-value pair class, we can add any object as value. However, we won't be able to do much on the extracted objects unless we cast them to a more specific. To find a good balance, you might want to go for something in between specific buttons and any object and request the value to be a component: kvc: TKeyValue<TComponent>; Finally, we can create an instance of the generic key-value pair class that doesn't store object values, but rather plain integers, as shown: kvi: TKeyValue<Integer>; TYPE RULES ON GENERICS When you declare an instance of a generic, this gets a specific version, which is enforced by the compiler in all subsequent operations. So, if you have a generic class like: TSimpleGeneric<T> = class Value: T; as you declare a specific object with a given, you cannot assign a different to the Value field. Given the following two objects, some of the assignments below are incorrect: sg1: TSimpleGeneric<string>; sg2: TSimpleGeneric<Integer>; sg1 := TSimpleGeneric<string>.Create; sg2 := TSimpleGeneric<Integer>.Create; sg1.value := 'foo'; Embarcadero Technologies - 3 -
5 sg1.value := 10; // Error // E2010 Incompatible s: 'string' and 'Integer' sg2.value := 'foo'; // Error // E2010 Incompatible s: 'Integer' and 'string' sg2.value := 10; Once you define a specific the generic declaration, this is enforced by the compiler, as you should expect by a strongly-d language like Object Pascal. The checking is also in place for the generic objects as a whole. As you specify the generic parameter for an object, you cannot assign to it a similar generic based on a different and incompatible instance. If this seems confusing, an example should help clarify: sg1 := TSimpleGeneric<Integer>.Create; // Error // E2010 Incompatible s: // 'TSimpleGeneric<System.string>' // and 'TSimpleGeneric<System.Integer>' The compatibility rule is by structure and not by name but you cannot assign to a generic instance a different and incompatible one. GENERICS IN DELPHI In the previous example, we saw how you can define and use a generic class which is one of the most relevant extensions to the Object Pascal language since Delphi 3 introduced interfaces. I decided to introduce the feature with an example before delving into the technicalities, which are quite complex and very relevant at the same time. After covering generics from a language perspective we'll get back to more examples, including the use and definition of generic container classes, one of the main reasons this technique was added to the language. We have seen that when you define a class in Delphi 2009, you can now add an extra parameter within angle brackets to hold the place of a to be provided later: TMyClass <T> = class... The generic can be used as the of a field (as I did in the previous example), as the of a property, as the of a parameter or return value of a function and more. Notice that it is not compulsory to use the for a local field (or array) as there are cases in which the generic is used only as a result, a parameter, or is not used in the declaration of the class, but only in the definition of some of its methods. This form of extended or generic declaration is available for classes and also for records (in the most recent versions of Delphi records can also have methods and overloaded operators, in case you didn t notice). You cannot declare a generic global function unlike C++, but you can declare a generic class with a single class method, which is almost the same thing. Embarcadero Technologies - 4 -
6 The implementation of generics in Delphi, like in other static languages, is not based on a runtime framework, but is handled by the compiler and the linker, and leaves almost nothing to runtime mechanism. Unlike virtual function calls that are bound at runtime, template methods are generated once for each template you instantiate, and are generated at compile time! We'll see the possible drawbacks of this approach, but, on the positive side, it implies that the generic classes are as efficient as plain classes, or even more efficient as the need for runtime cats is reduced. GENERIC TYPE FUNCTIONS The biggest problem with the generic definitions we ve seen so far is that you can do very little with objects of the generic. There are two techniques you can use to overcome this limitation. The first is to make use of the few special functions of the runtime library that specifically support generic s. The second (and much more powerful) is to define generic classes with constraints on the s you can use. I'll focus on the first part in this section and the constraints in the next section. As I mentioned, there is a brand new function and two classic ones specifically modified to work on the parametric (T) of generic definition: Default(T) is a brand new function that returns the empty or zero value or null value for the current ; this can be zero, an empty string, nil, and so on; TypeInfo (T) returns the pointer to the runtime information for the current version of the generic ; SizeOf (T) returns memory size of the in bytes. The following example has a generic class showing the three generic functions in action: TSampleClass <T> = class private data: T; public procedure Zero; function GetDataSize: Integer; function GetDataName: string; function TSampleClass<T>.GetDataSize: Integer; Result := SizeOf (T); function TSampleClass<T>.GetDataName: string; Result := GetTypeName (TypeInfo (T)); procedure TSampleClass<T>.Zero; Embarcadero Technologies - 5 -
7 data := Default (T); In the GetDataName method, I used the GetTypeName function (or the TypInfo unit) rather than directly accessing the data structure because it performs the proper UTF-8 conversion from the encoded ShortString value holding the name. Given the declaration above, you can compile the following test code that repeats itself three times on three different generic instances. I've omitted the repeated code, but kept the statements used to access the data field, as they change depending on the actual : t1: TSampleClass<Integer>; t2: TSampleClass<string>; t3: TSampleClass<double>; t1 := TSampleClass<Integer>.Create; t1.zero; Log ('TSampleClass<Integer>'); Log ('data: ' + IntToStr (t1.data)); Log (': ' + t1.getdataname); Log ('size: ' + IntToStr (t1.getdatasize)); t2 := TSampleClass<string>.Create;... Log ('data: ' + t2.data); t3 := TSampleClass<double>.Create;... Log ('data: ' + FloatToStr (t3.data)); Running this code produces the following output: TSampleClass<Integer> data: 0 : Integer size: 4 TSampleClass<string> data: : string size: 4 TSampleClass<double> data: 0 : Double size: 8 Notice that, oddly enough, you can use the generic functions also on specific s outside of the contest of generic classes. For example, you can write: Embarcadero Technologies - 6 -
8 I: Integer; s: string; I := Default (Integer); Log ('Default Integer': + IntToStr (I)); s := Default (string); Log ('Default String': + s); Log ('TypeInfo String': + GetTypeName (TypeInfo (string)); While the calls to Default are brand new in Delphi 2009 (although not terribly useful outside of templates), the call to TypeInfo at the end was already possible in past versions of Delphi. This is the trivial output: Default Integer: 0 Default String: TypeInfo String: string GENERIC CONSTRAINTS As we have seen, there is very little you can do with the methods of your generic class over the generic value. You can pass it around (that is, assign it) and perform the limited operations allowed by the generic functions I've just covered. To be able to perform some actual operations of the generic of class, you generally place a constraint on it. For example, when you limit the generic to be a class, the compiler will let you call all of the TObject methods on it. You can also further constrain the class to be part of a given hierarchy or implement a specific interface. CLASS CONSTRAINTS The simplest constraint you can adopt is a class constraint. To use it, you declare generic as: TSampleClass <T: class> = class By specifying a class constraint, you indicate that you can use only object s as generic s. With the following declaration: TSampleClass <T: class> = class private data: T; public procedure One; Embarcadero Technologies - 7 -
9 function ReadT: T; procedure SetT (t: T); you can create the first two instances but not the third: sample1: TSampleClass<TButton>; sample2: TSampleClass<TStrings>; sample3: TSampleClass<Integer>; // Error The compiler error caused by this last declaration would be: E2511 Type parameter 'T' must be a class What's the advantage of indicating this constraint? In the generic class methods you can now call any TObject method, including virtual ones! This is the One method of the TSampleClass generic class: procedure TSampleClass<T>.One; if Assigned (data) then Form30.Log('ClassName: ' + data.classname); Form30.Log('Size: ' + IntToStr (data.instancesize)); Form30.Log('ToString: ' + data.tostring); You can play with the program to see its actual effect as it defines and uses a few instances of the generic, as in the following code snippet: sample1: TSampleClass<TButton>; sample1 := TSampleClass<TButton>.Create; try sample1.sett (Sender as TButton); sample1.one; finally sample1.free; Notice that by declaring a class with a customized ToString method, this custom version will get called when the data object is of the specific, regardless of the actual provided to the generic. In other words, if you have a TButton descendant such as: TMyButton = class (TButton) public function ToString: string; override; Embarcadero Technologies - 8 -
10 You can pass this object as value of a TSampleClass<TButton> or define a specific instance of the generic, and in both cases calling One ends up executing the specific version of ToString: sample1: TSampleClass<TButton>; sample2: TSampleClass<TMyButton>; mb: TMyButton;... sample1.sett (mb); sample1.one; sample2.sett (mb); sample2.one; Similar to a class constraint, you can have a record constraint, declared as: TSampleRec <T: record> = class However, there is very little that different records have in common (there is no common ancestor), so this declaration is somewhat limited. SPECIFIC CLASS CONSTRAINTS If your generic class needs to work with a specific subset of classes (a specific hierarchy), you might want to resort to specifying a constraint based on a given base class. For example, if you declare: TCompClass <T: TComponent> = class instances of this generic class can be applied only to component classes; that is, any Tcomponent descendant class. This lets you have a very specific generic (yes it sounds odd, but that's what it really is) and the compiler will let you use all of the methods of the TComponent class while working on the generic. If this seems extremely powerful, think twice. If you consider what you can achieve with inheritance and compatibly rules, you might be able to address the same problem using traditional, object-oriented techniques rather than having to use generic classes. I'm not saying that a specific class constraint is never useful, but it is certainly not as powerful as a higher-level class constraint or (something I find very interesting) an interface-based constraint. INTERFACE CONSTRAINTS Rather than constraining a generic class to a given class, it is generally more flexible to accept only classes implementing a given interface as the parameter. This makes it possible to call the interface on instances of the generic. Embarcadero Technologies - 9 -
11 That said, the use of interface constraints for generics is also very common in the.net framework. Let me start by showing you an example. First, we need to declare an interface: IGetValue = interface ['{60700EC4-2CDA-4CD1-A1A D9D2444}'] function GetValue: Integer; procedure SetValue (Value: Integer); property Value: Integer read GetValue write SetValue; Next, we can define a class that implements it: TGetValue = class (TSingletonImplementation, IGetValue) private fvalue: Integer; public constructor Create (Value: Integer = 0); function GetValue: Integer; procedure SetValue (Value: Integer); Things start to get interesting when you define a generic class limited to s that implement the given interface: TInftClass <T: IGetValue> = class private val1, val2: T; // or IGetValue public procedure Set1 (val: T); procedure Set2 (val: T); function GetMin: Integer; function GetAverage: Integer; procedure IncreaseByTen; Notice that in the code for the generic methods of this class we can write: function TInftClass<T>.GetMin: Integer; Result := min (val1.getvalue, val2.getvalue); procedure TInftClass<T>.IncreaseByTen; Embarcadero Technologies
12 val1.setvalue (val1.getvalue + 10); val2.value := val2.value + 10; With all these definitions, we can now use the generic class as follows: procedure TFormIntfConstraint.btnValueClick( Sender: TObject); iclass: TInftClass<TGetValue>; iclass := TInftClass<TGetValue>.Create; iclass.set1 (TGetValue.Create (5)); iclass.set2 (TGetValue.Create (25)); Log ('Average: ' + IntToStr (iclass.getaverage)); iclass.increasebyten; Log ('Min: ' + IntToStr (iclass.getmin)); To show the flexibility of this generic class, I've created another totally different implementation for the interface: TButtonValue = class (TButton, IGetValue) public function GetValue: Integer; procedure SetValue (Value: Integer); class function MakeTButtonValue (Owner: TComponent; Parent: TWinControl): TButtonValue; { TButtonValue } function TButtonValue.GetValue: Integer; Result := Left; procedure TButtonValue.SetValue(Value: Integer); Left := Value; The class function creates a button within a Parent control in a random position and is used in the following sample code: procedure TFormIntfConstraint.btnValueButtonClick( Sender: TObject); iclass: TInftClass<TButtonValue>; iclass := TInftClass<TButtonValue>.Create; Embarcadero Technologies
13 iclass.set1 (TButtonValue.MakeTButtonValue ( self, ScrollBox1)); iclass.set2 (TButtonValue.MakeTButtonValue ( self, ScrollBox1)); Log ('Average: ' + IntToStr (iclass.getaverage)); Log ('Min: ' + IntToStr (iclass.getmin)); iclass.increasebyten; Log ('New Average: ' + IntToStr (iclass.getaverage)); INTERFACE REFERENCES VS. GENERIC INTERFACE CONSTRAINTS In the last example I defined a generic class that works with any object implementing a given interface. I could have obtained a similar effect by creating a standard (non-generic) class based on interface references. In fact, I could have defined a class like: TPlainInftClass = class private val1, val2: IGetValue; public procedure Set1 (val: IGetValue); procedure Set2 (val: IGetValue); function GetMin: Integer; function GetAverage: Integer; procedure IncreaseByTen; What is the difference between these two approaches? One difference is that in the class above you can pass two objects of different s to the setter methods provided their classes both implement the given interface. While in the generic version you can pass (to any given instance of the generic class) only objects of the given. So, the generic version is more conservative and strict in terms of checking. In my opinion, the key difference is that using the interface-based version means using the Delphi reference counting mechanism, while using the generic version the class deals with plain objects of a given and reference counting is not involved. Moreover, the generic version could have multiple constraints (like a constructor constraint) and lets you use the ious generic-functions (like asking for the actual of the generic ). This is something you cannot do when using an interface. (When you are working with an interface, in fact, you have no access to the base TObject method). In other words, using a generic class with interface constraints makes it possible to have the benefits of interfaces without their nuisances. Still, it is relevant to notice that in most cases the two approaches are equivalent, and in others, the interface-based solution is more flexible. USING PREDEFINED GENERIC CONTAINERS Since the early days of templates in the C++ language, one of the most obvious uses of generic classes has been the definition of generic containers, lists, or containers. When you define a list Embarcadero Technologies
14 of objects, like Delphi's own TObjectList, in fact, you have a list that can potentially hold objects of any kind. Using either inheritance or composition you can indeed define custom container for a specific, but this is a tedious (and potentially error-prone) approach. Delphi 2009 defines a small set of generic container classes you can find in the new Generics.Collections unit. The four core container classes are all implemented in an independent way (they don't inherit from the other), all implemented in a similar fashion (using a dynamic array), and all mapped to the corresponding non-generic container class of the Contnrs unit: TList<T> = class TQueue<T> = class TStack<T> = class TDictionary<TKey,TValue> = class The logical difference among these classes should be quite obvious considering their names. A good way to test them is to figure out how many changes you have to perform on existing code that uses a non-generic container class. As an example, I've taken an actual sample program of the Mastering Delphi 2005 book and converted it to use generics. USING TLIST<T> The sample program has a unit that defines a TDate class and the main form is used to refer to a TList of dates. As a starting point, I added a uses clause referring to Generics.Collections, and then I changed the declaration of the main form field to: private ListDate: TList <TDate>; Of course, the main form OnCreate event handler that creates the list needs to be updated as well, becoming: procedure TForm1.FormCreate(Sender: TObject); ListDate := TList<TDate>.Create; Now we can try to compile the rest of the code as it is. The program has a wanted bug, trying to add a TButton object to the list. The corresponding code used to compile, now fails: procedure TForm1.ButtonWrongClick(Sender: TObject); // add a button to the list ListDate.Add (Sender); // Error: // E2010 Incompatible s: 'TDate' and 'TObject' The new list of dates is more robust in terms of -checking than the original generic list pointers. Having removed that line the program compiles and works. Still, it can be improved. Embarcadero Technologies
15 This is the original code used to display all of the dates of the list in a ListBox control: I: Integer; ListBox1.Clear; for I := 0 to ListDate.Count - 1 do Listbox1.Items.Add ( (TObject(ListDate [I]) as TDate).Text); Notice the rather ugly cast, due to the fact that the program was using a list of pointers (TList), and not a list of objects (TObjectList). The reason might as well be that the original demo predates the TObjectList class! One can easily improve the program by writing: for I := 0 to ListDate.Count - 1 do Listbox1.Items.Add (ListDate [I].Text); Another improvement to this snippet could come from using an enumeration (something the predefined generic lists fully support) rather than a plain for loop: adate: TDate; for adate in ListDate do Listbox1.Items.Add (adate.text); Finally, the program could be improved by using a generic TObjectList owning the TDate objects, but that's a topic for the next section. As I mentioned earlier, the TList<T> generic class has a high degree of compatibility. There are all the classic methods, like Add, Insert, Remove, and IndexOf. The Capacity and Count properties are there as well. Oddly, Items become Item, but being the default property you seldom explicitly refer to it anyway. SORTING A TLIST<T> What is interesting to understand is how sorting works (my goal here is to add sorting support to the previous example). The Sort method is defined as: procedure Sort; overload; procedure Sort(const AComparer: IComparer<T>); overload; where the IComparer<T> interface is declared in the Generics.Defaults unit. If you call the first version the program it will use the default comparer, initialized by the default constructor of TList<T>. In our case, this will be useless. Embarcadero Technologies
16 What we need to do instead, is to define a proper implementation of the IComparer<T> interface. For compatibility, we need to define an implementation that works on the specific TDate class. There are multiple ways to accomplish this, including using anonymous methods (covered in the next section).it is also an interesting technique because it gives me the opportunity to show several usage patterns of generics and takes advantage of a structural class that is part of the unit Generics.Defaults that is called TComparer. The class is defined as an abstract and generic implementation of the interface, as follows: TComparer<T> = class(tinterfacedobject, IComparer<T>) public class function Default: IComparer<T>; class function Construct( const Comparison: TComparison<T>): IComparer<T>; function Compare( const Left, Right: T): Integer; virtual; abstract; What we have to do is instantiate this generic class for the specific data (TDate, in the example) and also inherit a concrete class that implements the Compare method for the specific. The two operations can be done at once, using a coding idiom that takes a while to digest: TDateComparer = class (TComparer<TDate>) function Compare( const Left, Right: TDate): Integer; override; If this code looks very unusual to you, you're not alone. The new class is inherited from a specific instance of the generic class, something you could express in two separate steps as: TAnyDateComparer = TComparer<TDate>; TMyDateComparer = class (TAnyDateComparer) function Compare( const Left, Right: TDate): Integer; override; You can find the actual implementation of the Compare function in the source code, though that's not the key point I want to stress here. Keep in mind, though, that even if you sort the list its IndexOf method won't take advantage of it (unlike the TStringList class). SORTING WITH AN ANONYMOUS METHOD The sorting code presented in the previous section looks quite complicated and it really is. It would be much easier and cleaner to pass the sorting function to the Sort method directly. In the past, this was generally achieved by passing a function pointer. In Delphi 2009, this can be obtained by passing an anonymous method. Embarcadero Technologies
17 The IComparer<T> parameter of the Sort method of the TList<T> class, in fact, can be used by calling the Construct method of TComparer<T>, passing as parameter an anonymous method defined as: TComparison<T> = reference to function( const Left, Right: T): Integer; In practice you can write a -compatible function and pass it as parameter: function DoCompare (const Left, Right: TDate): Integer; ldate, rdate: TDateTime; ldate := EncodeDate(Left.Year, Left.Month, Left.Day); rdate := EncodeDate(Right.Year, Right.Month, Right.Day); if ldate = rdate then Result := 0 else if ldate < rdate then Result := -1 else Result := 1; procedure TForm1.ButtonAnonSortClick(Sender: TObject); ListDate.Sort (TComparer<TDate>.Construct (DoCompare)); If this looks too traditional, consider you could also avoid the declaration of a separate function and pass it (its source code) as parameter to the Construct method, as follows: procedure TForm1.ButtonAnonSortClick(Sender: TObject); ListDate.Sort (TComparer<TDate>.Construct ( function (const Left, Right: TDate): Integer ldate, rdate: TDateTime; ldate := EncodeDate(Left.Year, Left.Month, Left.Day); rdate := EncodeDate(Right.Year, Right.Month, Right.Day); if ldate = rdate then Result := 0 else if ldate < rdate then Result := -1 else Result := 1; end)); Embarcadero Technologies
18 This example should have whetted your appetite for learning more about anonymous methods! For sure, this last version is much simpler to write than the original covered in the previous section. Although, having a derived class might look cleaner and be easier to understand for many Delphi developers. ANONYMOUS METHODS (OR CLOSURES) The Delphi language has had procedural s (s declaring pointers to procedures and functions) and method pointers (s declaring pointers to methods) for a long time. Although you seldom use them directly, these are key features of Delphi that every developer works with. In fact, method pointers s are the foundation for event handlers in the VCL: every time you declare an event handler, even a pure Button1Click you are declaring a method that will be connected to an event (the OnClick event, in this case) using a method pointer. Anonymous methods extend this feature by letting you pass the actual code of a method as a parameter, rather than the name of a method defined elsewhere. This is not the only difference, though. What makes anonymous methods very different from other techniques is the way they manage the lifetime of local iables. Anonymous methods are a brand new feature for Delphi, but they've been around in different forms and with different names for many years in other programming languages--most notably dynamic languages. I've had extensive experience with closures in JavaScript, particularly with the jquery ( library and AJAX calls. The corresponding feature in C# is anonymous delegate. But I don't want to devote time comparing closures and related techniques in the ious programming languages, but instead describe in detail how they work in Delphi SYNTAX AND SEMANTIC OF ANONYMOUS METHODS An anonymous method in Delphi is a mechanism to create a method value in an expression context. A rather cryptic definition, but one that underlines the key difference from method pointers: the expression context. Before we get to this, let me start from the ning with a very simple code example. This is the declaration of an anonymous method, something you need as Delphi remains a strongly-d language: TIntProc = reference to procedure (n: Integer); This differs from a reference method only in the keywords being used for the declaration: TIntMethod = procedure (n: Integer) of object; Embarcadero Technologies
19 AN ANONYMOUS METHOD VARIABLE Once you have an anonymous method you can declare a iable of this, assign a -compatible anonymous method, and call the method through the iable: procedure TFormAnonymFirst.btnSimpleVarClick( Sender: TObject); anintproc: TIntProc; anintproc := procedure (n: Integer) Memo1.Lines.Add (IntToStr (n)); anintproc (22); Notice the syntax used to assign an actual procedure with in-place code to the iable. This is something never seen in Pascal in the past. AN ANONYMOUS METHOD PARAMETER As a more interesting example (with an even more surprising syntax), we can pass an anonymous method as parameter to a function. Suppose you have a function taking an anonymous method parameter: procedure CallTwice (value: Integer; anintproc: TIntProc); anintproc (value); Inc (value); anintproc (value); The function calls the method passed as parameter twice with two consecutive integer values, the one passed as parameter and the following one. You call the function by passing an actual anonymous method to it, with directly in-place code that looks surprising: procedure TFormAnonymFirst.btnProcParamClick( Sender: TObject); CallTwice (48, procedure (n: Integer) Memo1.Lines.Add (IntToHex (n, 4)); end); CallTwice (100, procedure (n: Integer) Memo1.Lines.Add (FloatToStr(Sqrt(n))); Embarcadero Technologies
20 end); From the syntax point of view, notice the procedure passed as parameter with parentheses and not terminated by a semicolon. The actual effect of the code is to call the IntToHex with 48 and 49 and the FloatToStr on the square root of 100 and 101, producing the following output: USING LOCAL VARIABLES Even with a different and less nice syntax, we could have achieved the same effect using method pointers. What makes the anonymous methods clearly different is the way they can refer to local iables of the calling method. Consider the following code: procedure TFormAnonymFirst.btnLocalValClick( Sender: TObject); anumber: Integer; anumber := 0; CallTwice (10, procedure (n: Integer) Inc (anumber, n); end); Memo1.Lines.Add (IntToStr (anumber)); Here the method (still passed to the CallTwice procedure) uses the local parameter n, but also a local iable in the calling context, anumber. What's the effect? The two calls of the anonymous method will modify the local iable, adding the parameter to it, 10 the first time and 11 the second. The final value of anumber will be 21. EXTENDING THE LIFETIME OF LOCAL VARIABLES The previous example shows an interesting effect, but with a sequence of nested function call, and the fact you can use the local iable isn't that surprising. The power of anonymous methods, however, lies in the fact they can use a local iable and also extend its lifetime as needed. An example will prove the point more than a lengthy explanation. Embarcadero Technologies
21 I've added (using class completion) to the TFormAnonymFirst form class a property of an anonymous method pointer (well, actually the same anonymous method pointer I've used in all of the code for the project): private FAnonMeth: TIntProc; procedure SetAnonMeth(const Value: TIntProc); public property AnonMeth: TIntProc read FAnonMeth write SetAnonMeth; Then, I've added two more buttons to the form. The first saves an anonymous method in the property that uses a local iable (more or less like in the previous btnlocalvalclick method): procedure TFormAnonymFirst.btnStoreClick( Sender: TObject); anumber: Integer; anumber := 3; AnonMeth := procedure (n: Integer) Inc (anumber, n); Memo1.Lines.Add (IntToStr (anumber)); When this method executes, the anonymous method is not executed, only stored. The local iable anumber is initialized to zero, is not modified, goes out of local scope (as the method terminates), and is displaced. At least, that is what you'd expect from a standard Delphi code. The second button I added to the form for this specific step is called the anonymous method and is stored in the AnonMeth property: procedure TFormAnonymFirst.btnCallClick(Sender: TObject); if Assigned (AnonMeth) then CallTwice (2, AnonMeth); When this code is executed, it calls on an anonymous method that uses the local iable anumber of a method that's not on the stack any more. However, since anonymous methods capture their execution context, the iable is still there and can be used as long as that given instance of the anonymous method (that is, a reference to the method) is around. Embarcadero Technologies
22 As further proof, do the following: press the Store button once, the Call button two times, and you'll see that same captured iable being used: Now press Store once more and press Call again. Why is the value of the local iable reset? By assigning a new anonymous methods instance, the old one is deleted (along with its own execution context) and a new execution context is captured, including a new instance of the local iable. The full sequence Store Call Call Store Call produces: It is the implication of this behavior, resembling what some other languages do, that makes anonymous methods an extremely powerful language feature that you can use to implement something literally impossible in the past. OTHER NEW LANGUAGE FEATURES With so many new relevant features in the Object Pascal language, it is easy to miss some of the minor ones. A COMMENTED DEPRECATED DIRECTIVE The deprecated directive (used to indicate a symbol) is still available for compatibility reasons only but can now be followed by a string that will be displayed as part of the compiler warning. If you define a procedure and call it as in the following code snippet: procedure DoNothing; deprecated 'use DoSomething instead'; procedure TFormMinorLang.btnDepracatedClick( Sender: TObject); DoNothing; At the call location (in the btndepracatedclick method) you'll get the following warning: W1000 Symbol 'DoNothing' is deprecated: 'use DoSomething instead' Embarcadero Technologies
23 This is much better than the previous practice of adding a comment to the declaration of the deprecated symbol: having a to click on the error message to get to the source code line in which this is used, jump to the declaration location, and find the comment. Needless to say, the code above won't compile in Delphi 2007, where you get the error: E2029 Declaration expected but string constant found The new feature of deprecated is used rather heavily in the Delphi 2009 RTL and VCL, while I'm expecting that third party vendors will have to refrain from using it because of the incompatibility with past versions of the compiler. EXIT WITH A VALUE Traditionally, Pascal functions used to assign a result by using the function name, as in: function ComputeValue: Integer;... ComputeValue := 10; Delphi has long provided an alternate coding, using the Result identifier to assign a return value to a function: function ComputeValue: Integer;... Result := 10; The two approaches are identical and do not alter the flow of the code. If you need to assign the function result and stop the current execution you can use two separate statements, assign the result and then call Exit. The following code snippet (looking for a string containing a given number in a string list) shows a classic example of this approach: function FindExit (sl: TStringList; n: Integer): string; I: Integer; for I := 0 to sl.count do if Pos (IntToStr (n), sl[i]) > 0 then Result := sl[i]; Exit; In Delphi 2009, you can replace the two statements with a new special call to Exit, passing to it the return value of the function, in a way resembling the C language return statement. So Embarcadero Technologies
24 you can write the code above in a more compact version (also because with a single statement you can avoid the /end): function FindExitValue ( sl: TStringList; n: Integer): string; I: Integer; for I := 0 to sl.count do if Pos (IntToStr (n), sl[i]) > 0 then Exit (sl[i]); NEW AND ALIASED INTEGRAL TYPES Although this is not strictly a compiler change, but rather, an addition in the System unit, you can now use a set of easier-to-remember aliases for signed and unsigned integral data s. These are the signed and unsigned predefined s in the compiler: ShortInt SmallInt Integer NativeInt Int64 Byte Word Cardinal NativeUInt UInt64 These s were already in Delphi 2007 and previous versions, but the 64bit ones date back only a few versions of the compiler. The NativeInt and NativeUInt s, which should depend on the compiler version (32 bit and future 64 bit) were already in Delphi 2007, but, they were not documented. If you need a data that will match the CPU native integer size, these are the s to use. The Integer, in fact, is expected to remain unchanged when moving from 32-bit to 64-bit compilers. The following set of predefined aliases added by System unit is brand new in Delphi 2009: Int8 = ShortInt; Int16 = SmallInt; Int32 = Integer; UInt8 = Byte; UInt16 = Word; UInt32 = Cardinal; Embarcadero Technologies
25 Although they don't add anything new, they are probably easier to use because it is generally hard to remember if a ShortInt is smaller than a SmallInt, and it is easy to remember the actual implementation of Int16 or Int8. CONCLUSION I ve outlined a few interesting things that were added to the Delphi language, but what makes a huge difference in this version of the compiler is the support for generics, for anonymous methods, and the combination of the two. These features don't merely extend the Delphi language, but open it up for new programming paradigms beside the classic object-oriented programming and event-driven programming approaches Delphi traditionally featured. The ability of having classes parameterized on one or more data s and that of passing routines as parameters open up new coding styles and new ways of architecting Delphi applications. The language power is here in Delphi 2009, but it will take a while before libraries and components start taking full advantage of these features. Still, with Delphi 2009, you can start working out new coding techniques today. ABOUT THE AUTHOR This white paper has been written for Embarcadero Technologies by Marco Cantù, author of the best-selling series, Mastering Delphi. The content has been extracted from his latest book, Delphi 2009 Handbook, You can read about Marco on his blog ( and reach him at his address: [email protected]. Embarcadero Technologies
26 Embarcadero Technologies, Inc. is a leading provider of award-winning tools for application developers and database professionals so they can design systems right, build them faster and run them better, regardless of their platform or programming language. Ninety of the Fortune 100 and an active community of more than three million users worldwide rely on Embarcadero products to increase productivity, reduce costs, simplify change management and compliance and accelerate innovation. The company s flagship tools include: Embarcadero Change Manager, CodeGear RAD Studio, DBArtisan, Delphi, ER/Studio, JBuilder and Rapid SQL. Founded in 1993, Embarcadero is headquartered in San Francisco, with offices located around the world. Embarcadero is online at Embarcadero Technologies
Delphi Developer Certification Exam Study Guide
Delphi Developer Certification Exam Study Guide Embarcadero Technologies Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco, California 94111
Setting up IIS on Windows 7: Build Web Services with RAD Studio 2010
Tech Notes Setting up IIS on Windows 7: Build Web Services with RAD Studio 2010 Michael Rozlog Sr. Director of Delphi Solutions, Embarcadero Technologies November 2009 Corporate Headquarters EMEA Headquarters
New Tools for Faster SQL Tuning and Analysis Embarcadero Technologies
Tech Notes New Tools for Faster SQL Tuning and Analysis Embarcadero Technologies November 2009 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco,
Why Data Warehouse Projects Fail Using Schema Examination Tools to Ensure Information Quality, Schema Compliance, and Project Success
Tech Notes Why Data Warehouse Projects Fail Using Schema Examination Tools to Ensure Information Quality, Schema Compliance, and Project Success Embarcadero Technologies January 2008 Corporate Headquarters
Tech Notes. Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco, California 94111
Tech Notes Faster Application Development via Improved Database Change Management Integrating Database Change Management with Software Development to Reduce Errors, Re-Work, and Testing Efforts Embarcadero
Using Database Monitoring Tools to Measure, Manage, and Prove SLA Compliance Embarcadero Technologies
Tech Notes Using Database Monitoring Tools to Measure, Manage, and Prove SLA Compliance Embarcadero Technologies August 2008 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California
Selecting the Right Change Management Solution Key Factors to Consider When Evaluating Change Management Tools for Your Databases and Teams
Tech Notes Selecting the Right Change Management Solution Key Factors to Consider When Evaluating Change Management Tools for Your Databases and Teams Embarcadero Technologies July 2007 Corporate Headquarters
Software Development Predictions For 2009
Tech Notes Top Ten Software Development Predictions for 2009 Michael Rozlog, Embarcadero Technologies January 2009 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street,
ER/Studio Data Architect
Product Documentation ER/Studio Data Architect New Features Guide Version 11.0/XE7 Published April 22, 2015 2015 Embarcadero Technologies, Inc. Embarcadero, the Embarcadero Technologies logos, and all
From Visual C++ Application to Native Mac in 90 Seconds
From Visual C++ Application to Native Mac By Jason Vokes Embarcadero Technologies April 2012 Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco,
Embarcadero ToolCloud for XE Quick Start Guide. ToolCloud 1.7.1 for Embarcadero XE Products Last Published May 5, 2010
Embarcadero ToolCloud for XE Quick Start Guide ToolCloud 1.7.1 for Embarcadero XE Products Last Published May 5, 2010 2010 Embarcadero Technologies, Inc. Embarcadero, the Embarcadero Technologies logos,
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
16 Collection Classes
16 Collection Classes Collections are a key feature of the ROOT system. Many, if not most, of the applications you write will use collections. If you have used parameterized C++ collections or polymorphic
Healthcare Data Management Survey Report
Healthcare Data Management Survey Report Embarcadero Technologies June 2010 Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor San Francisco, California
Managing Java EE Performance with Embarcadero s J Optimizer Request Analyzer
Tech Notes Managing Java EE Performance with Embarcadero s J Optimizer Request Analyzer Al F. Mannarino, Embarcadero Technologies June 2008 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters
InterBase SMP: Safeguarding Your Data from Disaster
Tech Notes InterBase SMP: Safeguarding Your Data from Disaster Embarcadero Technologies February 2009 Corporate Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street, 12th Floor
Considerations: Mastering Data Modeling for Master Data Domains
Considerations: Mastering Data Modeling for Master Data Domains David Loshin President of Knowledge Integrity, Inc. June 2010 Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
PL/SQL Overview. Basic Structure and Syntax of PL/SQL
PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension
Cloud Computing for Technology Tools
White Paper Cloud Computing for Technology Tools Leveraging cloud principles to deliver tools to application developers and database professionals Embarcadero Technologies, Inc. March 2010 Corporate Headquarters
09336863931 : provid.ir
provid.ir 09336863931 : NET Architecture Core CSharp o Variable o Variable Scope o Type Inference o Namespaces o Preprocessor Directives Statements and Flow of Execution o If Statement o Switch Statement
Curriculum Map. Discipline: Computer Science Course: C++
Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code
[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
Java (12 Weeks) Introduction to Java Programming Language
Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short
Everything PHP Developers Need to Be Productive Introducing Delphi for PHP 2.0
Tech Notes Everything PHP Developers Need to Be Productive Introducing Delphi for PHP 2.0 Andreano Lanusse, Embarcadero Technologies February 2009 Corporate Headquarters EMEA Headquarters Asia-Pacific
Visual Basic. murach's TRAINING & REFERENCE
TRAINING & REFERENCE murach's Visual Basic 2008 Anne Boehm lbm Mike Murach & Associates, Inc. H 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 [email protected] www.murach.com Contents Introduction
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages Corky Cartwright Swarat Chaudhuri November 30, 20111 Overview I In OO languages, data values (except for designated non-oo
Variable Base Interface
Chapter 6 Variable Base Interface 6.1 Introduction Finite element codes has been changed a lot during the evolution of the Finite Element Method, In its early times, finite element applications were developed
Why you shouldn't use set (and what you should use instead) Matt Austern
Why you shouldn't use set (and what you should use instead) Matt Austern Everything in the standard C++ library is there for a reason, but it isn't always obvious what that reason is. The standard isn't
Symbol Tables. Introduction
Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The
Facebook Twitter YouTube Google Plus Website Email
PHP MySQL COURSE WITH OOP COURSE COVERS: PHP MySQL OBJECT ORIENTED PROGRAMMING WITH PHP SYLLABUS PHP 1. Writing PHP scripts- Writing PHP scripts, learn about PHP code structure, how to write and execute
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
JetBrains ReSharper 2.0 Overview Introduction ReSharper is undoubtedly the most intelligent add-in to Visual Studio.NET 2003 and 2005. It greatly increases the productivity of C# and ASP.NET developers,
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Introducing DocumentDB
David Chappell Introducing DocumentDB A NoSQL Database for Microsoft Azure Sponsored by Microsoft Corporation Copyright 2014 Chappell & Associates Contents Why DocumentDB?... 3 The DocumentDB Data Model...
PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON
PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London
C++ Programming Language
C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along
Oracle Database: SQL and PL/SQL Fundamentals NEW
Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the
C++FA 5.1 PRACTICE MID-TERM EXAM
C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer
Best Practices and a Must Have Toolset for SOA Migration Projects
White Paper Best Practices and a Must Have Toolset for SOA Migration Projects Six Ways to Leverage Embarcadero All-Access Ron Lewis, CDO Technologies February 2010 Corporate Headquarters EMEA Headquarters
Lecture 9. Semantic Analysis Scoping and Symbol Table
Lecture 9. Semantic Analysis Scoping and Symbol Table Wei Le 2015.10 Outline Semantic analysis Scoping The Role of Symbol Table Implementing a Symbol Table Semantic Analysis Parser builds abstract syntax
Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)
Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer
Web development... the server side (of the force)
Web development... the server side (of the force) Fabien POULARD Document under license Creative Commons Attribution Share Alike 2.5 http://www.creativecommons.org/learnmore Web development... the server
Simple Document Management Using VFP, Part 1 Russell Campbell [email protected]
Seite 1 von 5 Issue Date: FoxTalk November 2000 Simple Document Management Using VFP, Part 1 Russell Campbell [email protected] Some clients seem to be under the impression that they need to
Raima Database Manager Version 14.0 In-memory Database Engine
+ Raima Database Manager Version 14.0 In-memory Database Engine By Jeffrey R. Parsons, Senior Engineer January 2016 Abstract Raima Database Manager (RDM) v14.0 contains an all new data storage engine optimized
CS193j, Stanford Handout #10 OOP 3
CS193j, Stanford Handout #10 Summer, 2003 Manu Kumar OOP 3 Abstract Superclass Factor Common Code Up Several related classes with overlapping code Factor common code up into a common superclass Examples
Migration Manager v6. User Guide. Version 1.0.5.0
Migration Manager v6 User Guide Version 1.0.5.0 Revision 1. February 2013 Content Introduction... 3 Requirements... 3 Installation and license... 4 Basic Imports... 4 Workspace... 4 1. Menu... 4 2. Explorer...
1. To start Installation: To install the reporting tool, copy the entire contents of the zip file to a directory of your choice. Run the exe.
CourseWebs Reporting Tool Desktop Application Instructions The CourseWebs Reporting tool is a desktop application that lets a system administrator modify existing reports and create new ones. Changes to
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
Computer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
Top 10 Considerations for Choosing Database Tools Beyond the Feature Matrix
Top 10 Considerations for Choosing Database Tools Beyond the Feature Matrix By Elias Terman Sr. Product Marketing Manager Embarcadero Technologies May 2010 Americas Headquarters EMEA Headquarters Asia-Pacific
7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com
Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally
Code Qualities and Coding Practices
Code Qualities and Coding Practices Practices to Achieve Quality Scott L. Bain and the Net Objectives Agile Practice 13 December 2007 Contents Overview... 3 The Code Quality Practices... 5 Write Tests
Overview. Elements of Programming Languages. Advanced constructs. Motivating inner class example
Overview Elements of Programming Languages Lecture 12: Object-oriented functional programming James Cheney University of Edinburgh November 6, 2015 We ve now covered: basics of functional and imperative
The Delphi Language for Mobile Development
The Delphi Language for Mobile Development Marco Cantù, Delphi Product Manager Embarcadero Technologies April 2013 Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California Street,
Introduction. What is RAID? The Array and RAID Controller Concept. Click here to print this article. Re-Printed From SLCentral
Click here to print this article. Re-Printed From SLCentral RAID: An In-Depth Guide To RAID Technology Author: Tom Solinap Date Posted: January 24th, 2001 URL: http://www.slcentral.com/articles/01/1/raid
Binary storage of graphs and related data
EÖTVÖS LORÁND UNIVERSITY Faculty of Informatics Department of Algorithms and their Applications Binary storage of graphs and related data BSc thesis Author: Frantisek Csajka full-time student Informatics
MySQL 5.0 Stored Procedures
MySQL 5.0 Stored Procedures MySQL 5.0 New Features Series Part 1 A MySQL Technical White Paper Peter Gulutzan March, 2005 Copyright 2005, MySQL AB Table of Contents Introduction...3 A Definition and an
Conversion Constructors
CS106L Winter 2007-2008 Handout #18 Wednesday, February 27 Conversion Constructors Introduction When designing classes, you might find that certain data types can logically be converted into objects of
Introduction to Open Atrium s workflow
Okay welcome everybody! Thanks for attending the webinar today, my name is Mike Potter and we're going to be doing a demonstration today of some really exciting new features in open atrium 2 for handling
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
Python, C++ and SWIG
Robin Dunn Software Craftsman O Reilly Open Source Convention July 21 25, 2008 Slides available at http://wxpython.org/oscon2008/ Python & C++ Comparisons Each is a general purpose programming language,
Visual Basic Programming. An Introduction
Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides
Installation & User Guide
SharePoint List Filter Plus Web Part Installation & User Guide Copyright 2005-2011 KWizCom Corporation. All rights reserved. Company Headquarters KWizCom 50 McIntosh Drive, Unit 109 Markham, Ontario ON
QaTraq Pro Scripts Manual - Professional Test Scripts Module for QaTraq. QaTraq Pro Scripts. Professional Test Scripts Module for QaTraq
QaTraq Pro Scripts Professional Test Scripts Module for QaTraq QaTraq Professional Modules QaTraq Professional Modules are a range of plug in modules designed to give you even more visibility and control
Fast Arithmetic Coding (FastAC) Implementations
Fast Arithmetic Coding (FastAC) Implementations Amir Said 1 Introduction This document describes our fast implementations of arithmetic coding, which achieve optimal compression and higher throughput by
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health
AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason
Software Engineering Techniques
Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary
core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt
core. 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Volume I - Fundamentals Seventh Edition CAY S. HORSTMANN GARY
Chapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named
Objectif. Participant. Prérequis. Remarque. Programme. C# 3.0 Programming in the.net Framework. 1. Introduction to the.
Objectif This six-day instructor-led course provides students with the knowledge and skills to develop applications in the.net 3.5 using the C# 3.0 programming language. C# is one of the most popular programming
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
SuiteCRM for Developers
SuiteCRM for Developers Getting started with developing for SuiteCRM Jim Mackin This book is for sale at http://leanpub.com/suitecrmfordevelopers This version was published on 2015-05-22 This is a Leanpub
CS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
Java Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions
CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly
Randy Hyde s Win32 Assembly Language Tutorials (Featuring HOWL) #4: Radio Buttons
Randy Hyde s Win32 Assembly Language Tutorials Featuring HOWL #4: Radio Buttons In this fourth tutorial of this series, we ll take a look at implementing radio buttons on HOWL forms. Specifically, we ll
Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff
D80198GC10 Oracle Database 12c SQL and Fundamentals Summary Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff Level Professional Delivery Method Instructor-led
Revolutionized DB2 Test Data Management
Revolutionized DB2 Test Data Management TestBase's Patented Slice Feature Provides a Fresh Solution to an Old Set of DB2 Application Testing Problems The challenge in creating realistic representative
MapReduce. MapReduce and SQL Injections. CS 3200 Final Lecture. Introduction. MapReduce. Programming Model. Example
MapReduce MapReduce and SQL Injections CS 3200 Final Lecture Jeffrey Dean and Sanjay Ghemawat. MapReduce: Simplified Data Processing on Large Clusters. OSDI'04: Sixth Symposium on Operating System Design
C++ Wrapper Library for Firebird Embedded SQL
C++ Wrapper Library for Firebird Embedded SQL Written by: Eugene Wineblat, Software Developer of Network Security Team, ApriorIT Inc. www.apriorit.com 1. Introduction 2. Embedded Firebird 2.1. Limitations
Encoding Text with a Small Alphabet
Chapter 2 Encoding Text with a Small Alphabet Given the nature of the Internet, we can break the process of understanding how information is transmitted into two components. First, we have to figure out
The High Performance DBA Series Best Practices That Every Multi-Tasking DBA Must Know
The High Performance DBA Series Best Practices That Every Multi-Tasking DBA Must Know Embarcadero Technologies July 2010 Americas Headquarters EMEA Headquarters Asia-Pacific Headquarters 100 California
Oracle Database: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to
HP LoadRunner. Software Version: 11.00. Ajax TruClient Tips & Tricks
HP LoadRunner Software Version: 11.00 Ajax TruClient Tips & Tricks Document Release Date: October 2010 Software Release Date: October 2010 Legal Notices Warranty The only warranties for HP products and
GCE Computing. COMP3 Problem Solving, Programming, Operating Systems, Databases and Networking Report on the Examination.
GCE Computing COMP3 Problem Solving, Programming, Operating Systems, Databases and Networking Report on the Examination 2510 Summer 2014 Version: 1.0 Further copies of this Report are available from aqa.org.uk
Object Oriented Software Design II
Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February
