The first Delphi 2010 sneak peek video's showed up on the Internet. The first sneak peek shows some new IDE features like IDE insight, an everywhere context sensitive IDE navigation system.
Anders Ohlsson has a nice sum up of all the related Delphi 2010 blogposts.
Programming blogs containing .NET, C#, LINQ, Objective-C and Delphi experiences
Wednesday, August 05, 2009
Go see Delphi 2010
Tuesday, June 30, 2009
CodeRush for free, not for Delphi Prism
As blogged before you know that I think DevExpress CodeRush totally rocks!
Did you know that you can get a lot of this functionality for free?
Mark Miller has got a very nice list of features that are available in CodeRush Xpress for C# and Visual Basic inside Visual Studio 2008. All for free!
In the full product you will get even more, check out the differences in this article: Moving up from CodeRus Xpress to CodeRush
Delphi Prism
The downside of all this good stuff is that Delphi Prism is not supported. The fact that the original CodeRush was a pure Delphi IDE product, I can not believe that it will not be supported in the future.
Monday, June 29, 2009
The future of Delphi
I haven't had much time lately to follow everything on the Delphi side of the fence, but there is a lot going on.
Stefaan Lesage has a nice write up on this future, The future of Delphi looks brighter than ever before.
A very nice read, sums up everything that is cooking in the labs, including the roadmap.
Monday, May 18, 2009
Applying Domain-Driven Design - Book review
Before this weekend I got my copy of Applying Domain-Driven Design and Patterns by Jimmy Nilsson.
Althought the title, in my opinion should be "Applying Domain-Driven Design, Test Driven Design and Patterns", because beside DDD it covers a great deal of TDD also.
Design patterns for me were always a bit fuzzy, something from far-far-away land. However lately I am having more and more interest in Test Driven Devleopment and that software design method drives you towards better, testable, design, and Domain Driven Design seems to being just doing that.
Back to book
When you order a book about Design Patterns you expect it to be more a reference then a complete read, because the stuff looks to be boring ('dry stuff' as we say here), without trying it out.
In this book however the author takes you on a journey of software architecture, design and decisions. The book gives lots of "Aha!", "Huh?" and "Done that" moments which, I guess, keeps you awake.
It is loaded with lots of solutions for particular (recognizable) software problems, not just pushing Design Patterns, but making you think more about the right solutions, which always depends....
In just three days I have read half of the book already! For me that is rare.
So if you are interested in better software design I can highly recommend this book, it reads like a breeze!
Friday, April 24, 2009
Exploring Test Driven Development
A few weeks ago I attended a software event organized by the dutch Software Developer Network SDN. This time I followed a few sessions about Test Driven Development presented by (among others) Alex Thissen, Thomas Huijer and Dennis Doomen.
I must admit that before this sessions I was convinced that automated unit testing was a plus, but it would take just too much time (at least that is what I thought) so that I never actually used it. Triggered by this sessions I started to explore TDD and slowly but surely I am convinced by its pros.
So what is it?
TDD is not strictly about testing, but it is a software design method build upon testing. Check the TDD wiki for all the details, but basically it drills down to the following:
Every new feature in an application starts with building a test around one unit of code (a method or property), because of the fact that the real feature is not yet written that test will fail. After making the test you write the actual method which correctness can be checked by running the test.
Kind of strange huh? First test, then code. But when you think about it a little more it is a great way to improve your code quality.
Consider the following:
- By building a test you are triggered to think more about the specifications, heck by building the test you 'persist' the specifications in your code. (If specification changes, the test changes)
- It doesn't matter who writes the actual method, as long as the test fails he/she did not comply to the specifications.
- New features and specifications, which leads to refactoring your code, will be checked against your tests. If the test passes you will be fine.
In fact in TDD you will first change/refactor your test before refactoring the real code.
- You will try to keep test as small as possible, thus making smaller methods in your applications, thus making it less complex.
Less complex means more maintainable in the future. (Less time/costs)
“I don't care how good you think your design is. If I can't walk in and write a test for an arbitrary method of yours in five minutes its not as good as you think it is, and whether you know it or not, you're paying a price for it.”
Michael Feathers
Testing in Visual Studio
Visual Studio 2008 now offers unit testing. You can add a test project in your solution that refers your application/code library.
Making a first TDD application
Suppose we have some class Calculator with methods like Add, Divide etcetera.
Step 1
Create two test methods for the Add and Divide methods. A test method's result is stated by either an Assert, or an expected Exception:
[TestMethod]
public void Add()
{
int Int1 = 2;
int Int2 = 3;
int Result = calculator.Add(Int1, Int2);
Assert.AreEqual(5, Result);
}
[TestMethod]
public void Divide()
{
int Int1 = 6;
int Int2 = 3;
double Result = calculator.Divide(Int1, Int2);
Assert.AreEqual(2, Result);
}
[TestMethod]
[ExpectedException(typeof(DivideByZeroException))]
public void DivideByZero()
{
int Int1 = 6;
int Int2 = 0;
double Result = calculator.Divide(Int1, Int2);
}
In the test unit we created our Calculator class which we will test. Of course without the actual code this will not compile, so we create the initial method stubs, which will throw a not implemented exception.
Step 2
Run the tests. No supprise they will fail.
Step 3
Write the real methods:
public int Add(int Int1, int Int2)
{
return Int1 + Int2;
}
public double Divide(int Int1, int Int2)
{
return Int1 / Int2;
}
}
Step 4
Run the test. They succeed! Because the not so well choosen parameter names you could easily mismatch them in the method Divide, but your test will check for that!
What is next?
This example is rather simple. Complex codes, with for example database interaction will require some more coding for which you will write fakes and mocks. I will explore them in another post.
Conclusion
Although you might think that Test Driven Development takes a lot time in the process I am convinced (now) that it will pay back further on in the development process. Beside that it will boost the quality of your code and give you a base to safely refactor it in the future.
The examples where build in C#. I am not sure if this works in Delphi Prism as well, but I expect that it does.
Wednesday, April 08, 2009
CodeRush, when code smells...
At the beginning of this month Devexpress released the new version of their DXPerience products for .NET (Version 2009.1)
With the release of this components they also released a new version of their coding assisting tool CodeRush and Refactor Pro.
We use CodeRush for a couple of years now in Visual Studio for our C# work. Strange enough this new version somehow managed to trigger the "wow" factor once again.
I will not explain every new feature here, (You will find some resources at the end of this post) but one that is awesome in particular is Code Issues.
The Code Issues feature analyses your source code while your are working in your code. It gives you hints for Unused namespace references, unused methods, undisposed local vars etc, etc.
How does it work?
Hints appear in a bar near the scrollbar of the editor when you hover the mouse over the colored lines (each color is a hint category):
In this particular example, which seems to be extracted from some farmer application ;-), Coderush hints that a line of code where two strings are concatenated, could be refactored using string.format.
When you hover the code line, it shows you what you could do to improve your code: (or make it smell better)
This is really an impressive cool feature, that will boost the quality of your code.
Delphi Prism
Unfortunately CodeRush only supports C# and VB.NET at this moment. It would be very nice if CodeRush would support Delphi Prism as well.
Conclusion
Beside the fact that CodeRush helps you to boost your productivity with lots of code templates, it also helps you to track code smells and refactor them out of your software which will eventualy increase the quality of it.
You can find more resources on CodeRush here:
The Devexpress website
Mark Miller blog post "What's new in CodeRush & Refactor Pro"
This blogpost by Rory Becker
Thursday, March 12, 2009
New release for Delphi Prism
There is a new release of Delphi Prism available, according this edn article. The Delphi Prism February 2009 release (Build 3.0.17.591) as it is called (Wasn't it already March? ;-) ) contains the following changes.
Wednesday, January 07, 2009
TIOBE language of the year not Delphi
In october Jim Mckeeth reported that Delphi could well be the language of the year in the TIOBE Community language index.
Unfortunately this has not happened despite the efforts of the Delphi community putting "Delphi programming" on webpages.
In january Delphi is fallen slightly one place back to position 10. (Nothing to worry about). Remarkable is that Pascal went up 3 places compared with last year, now holding the 15th position. I predict that Pascal will become the language of the year 2009! ;-)
Language of the year 2008: C
For what it is worth........
What is your prediction?
Tuesday, January 06, 2009
LINQ with Delphi Prism #2 : Deferred Execution
As said in this previous post Delphi Prism supports LINQ all the way so all the LINQ feature just work in Delphi Prism.
Deferred Execution
One of the key features of LINQ is Deferred Execution. That means that a LINQ query does not execute until data is demanded, for except by an iteration through a list. This makes it possible to make a complex query without execution each part of the query seperately.
However, there is one exceptions to the rule, a LINQ query executes immediately when you use a function that must iterate over the list for its result like, for example Sum(), Count(), ToList() etc.
//Example of deferred execution or lazy execution
//-------------------------------------------
var Numbers := new List<integer>;
Numbers.Add(1);
var DoubledList : sequence of integer
:= Numbers.Select(n->n*2);
// Query not yet executed!
// Add another number to the list
Numbers.Add(2);
//At this point query is executed
//Result "2--4"
for i : Integer in DoubledList do begin
Result := Result + i.ToString + '--';
end;
MessageBox.Show(Result);
//Example of direct execution
//-------------------------------------------
var Numbers := new List<integer>;
Numbers.Add(1);
Numbers.Add(2);
//Query executed here
var Sum := (Numbers.Select(n->n*2)).Sum();
Numbers.Add(3);
Numbers.Add(4);
//Would expect 20, but result is only 6
MessageBox.Show(Sum.ToString);
Monday, January 05, 2009
LINQ with Delphi Prism #1 : Sequences
I have been digging into LINQ this christmas. LINQ is a cool way to query data, whether it is an array, a list or a remote datasource.
LINQ is a new feature of C# 3.0 that comes with Visual Studio 2008, but guess what, Delphi Prism, also supports LINQ all the way.
If you want to play/test LINQ queries syntax you can download and install LinqPad, a free tool to use LINQ querys against a SQL Server database. (You could drop Management Studio for that).
The only disadvantage I found (IMO) on LINQ so far is that quering remote datasources is bound to Microsoft SQL Server database. (Maybe this will be extended in the future)
That involves, the so called "LINQ to SQL" methods, which is, I believe, allready deprecated.
As said before Delphi Prism completely supports LINQ. Starting a 3.5 framework application will give you a reference to System.Linq, the namespace, where LINQ lives.
In this series I will explore LINQ using Delphi Prism:
1. Using LINQ on a sequence
LINQ, in Delphi Prism, works on so called sequences, which is a new type described in the Delphi Prism Wiki as:
Sequences are a special type in the language and can be thought of as a collection of elements, similar to an array.
Declare a sequence like this:
var
Names : sequence of String :=
['Mickey', 'Dick', 'Roland', 'Delphi', 'Harry'];
With LINQ it is very easy to query a collection, like this sequence. You can do this in two ways, namely:
1. Using Lambda expressions
2. Using query comprehension syntax (Query Syntax)
With Lambda expressions you can write rather small expressions to query the data, with the query syntax they become more readable (read less magic ;-)).
By the way the compiler (at least in C#) will translate the query syntax into lambda expressions. Both techniques are complementary. (I think the Oxygene compiler also does this....)
Suppose we want to have all the names from our sequence which have more then 4 characters, containing an "a" and sorted in upper case.
//Using Lambda syntax
var FilteredNames := Names
.Where (n -> (n.Length >= 4)
and n.Contains('a'))
.OrderBy (n -> n)
.Select (n -> n.ToUpper());
//Using query comprehension syntax
var FilteredNames := from n in Names
where ((n.Length >= 4)
and n.Contains('a'))
order by n
select n.ToUpper;
//Note we don't have to declare FilteredNames
Iterate through the filterednames to show them in a messagebox:
for s : string in FilteredNames do begin
FilteredOnes := FilteredOnes + s + "--"
end;
MessageBox.Show('FilteredOnes: ' + FilteredOnes)
Note that the original collection, Names in this case, is still holding all the elements.
Conclusion LINQ is a, in basic, simple way to query collections the SQL way. Delphi Prism supports them complete. Choosing Lambda expression or Query syntax will be mostly a personal preference.
Thursday, November 20, 2008
DevExpress will support Delphi Prism
Now that Delphi for .NET (now Delphi Prism) has become a Visual Studio plugin it is possible to use all the .NET components out there.
DevExpress, which btw started as a Delphi shop, has a great component set called DXperience for ASP.NET and Winforms development. Until now they only supported the Visual Studio IDE's.
You could use this components also in Delphi for .NET however they were not officialy supported. (No installation and technical support)
According to this blogpost by Julian Bucknall the CTO of DevExpress, it looks like they will support Delphi Prism in the official sense of the word.
The story is that we shall be supporting Delphi Prism with DXperience and we're evaluating what we need to do to make that work. As it happens: not very much -- it installs just fine and, on first blush, seems to work just fine. There are more exhaustive tests to complete, obviously.
Of course this is not an official statement......
We use the DXPerience components daily in our C# projects, and they are just great. We feel that Visual Studio with C#/VB.NET/Delphi Prism + DXPerience gives the developer the same power as Delphi for Win32 as we know it for so long. (For Winforms developement).
In my opinion this is great step for Delphi Prism in the .NET world.
Monday, October 27, 2008
Delphi Prism, some first thoughts
Added: Interview with marc hoffman, Chief Architect at Remobjects on Bitwise Magazine.
After five years of several solutions and directions, it looks like Delphi for .NET has finally found a good home.
Although Delphi .NET only exists for only about four years, there have been a lot of changes in the strategy executed by Borland, Borland/CodeGear and now Embarcadero. So let's take a brief look at the Delphi for .NET history:
2004 - Delphi 8 (Borland)
Delphi for .NET is born for the .NET Framework version 1.1. Delphi for .NET is positioned as a first class .NET citizen. It offers .NET 1.1 development for Winforms, ASP.NET and VCL.NET, which is the .NET variant of the VCL, offering a highly compatible framework based on .NET.
2005 - Delphi 2005 (Borland)
Delphi 2005 offers the same as Delphi 8 but Delphi 2005 has a lot improvements in quality.
2006 - Delphi 2006 (Borland)
Delphi 2006 still has support for the .NET Framework 1.1 (Winforms, ASP.NET and VCL.NET) Delphi 2006 offers a stable IDE for this developments. The fact that it does not support .NET 2.0 shows the trouble that Borland had to keep up with Microsoft.
2007 - Delphi 2007 (CodeGear/Borland)
Delphi 2007 finally supports .NET 2.0, but unfortunately the Winforms support is dropped. (Only ASP.NET and VCL.NET is supported)
2008 - Delphi 2008 (Embarcadero)
Delphi 2009 has become a Visual Studio Plugin based on Oxygene (formely known as Chrome) offering support for all available Microsoft .NET technology's (2.0, 3.0, 3.5))
Unfortunately it looks like VCL.NET is dropped.
It is not likely that the Delphi for .NET product strategy will be nominated for best executed product strategy ever.
However this is a very strong sign of the new spirit that Embarcadero is bringing to Delphi. It proofs that the buyout by Embarcadero is the best thing that happened to Delphi (and of course CodeGear) in the last five years.
Back to Delphi Prism:
Delphi Prism the pros
1. Instant support for all Microsoft .NET technologies.
2. The Delphi language is now at same level as C#, VB.NET, so the choice for the Delphi language can be made much easier. (Hack it is the same IDE)
3. Delphi for Win32 can focus on Win32 again, will not be hold back by .NET technologies.
Delphi Prism the cons
1. Less compatibilty with Delphi Win32 technologies, due to pure .NET and languages changes/additions. (Compared to VCL-VCL.NET, VCL-Winforms)
2. After Winforms, now VCL.NET dropped, and that will not please every body.
All with all the pros weigh more than the cons in my opinion.
Why use Delphi Prism?
This question is not answered easily. I think a lot of Delphi developers went for C# in the last four years. For example we decided in 2007 to standarize our .NET development on Visual Studio C# due to the dropping of Winforms in Delphi 2007 (Basicaly due to the mixed/confusing messages by Borland).
Conclusion
Although we don't know all the ins and outs yet (sure will hear a lot more the coming week) this is by far the best thing ever that happened to Delphi for .NET.
Wednesday, October 22, 2008
Exploring anonymous methods
New in Delphi 2009 are anonymous methods. Anonymous methods are methods without a name, which are able to do something on local variables where they are implemented. In fact they are a reference to a method.
Anonymous methods are a bit magic, at least they were to me, and hard to explain.
A nice place to use them is together with generics types. For instance the Sort method of a TList<T> is a natural place to use them:
PersonsList.Sort(TComparer<TPerson>.Construct(
function(const Item1, Item2: TPerson): Integer
begin
Result := CompareText(Item1.LastName,
Item2.LastName);
end));
A cool thing about anonymous methods is that it can execute your code (incl. local vars) in another place. This can be another unit or even another thread.
Implementing them in your daily code however is another thing. How to do that? Well here are my first explorations: Let's say we have this simple application that has a TStringList where we want to do some searching on the strings, based on the users input. I came up with this:
//Declaration of the anon reference
//The passed string will be searched on
type
TAnonStrProc =
reference to function(s : string) : Integer;
//Implement a method to execute
//1. Ask a string to search
//2. Execute the referenced method "proc"
function TForm4.FindString(proc: TAnonStrProc)
: Integer;
var
SearchStr : string;
begin
Result := -1;
if InputQuery('Search', 'Search a string',
SearchStr) then begin
Result := proc(SearchStr);
end;
end;
//Create a string list
procedure TForm4.Button1Click(Sender: TObject);
var
sla : TStrings;
i,j : Integer;
Index, Count : integer;
begin
sla := TStringList.Create;
try
sla.Add('One');
sla.Add('Two');
sla.Add('Three');
sla.Add('Two');
//Call the FindString method with anon method
//to get the index of string in the list
//Note that it does someting with our local
//variable sla
Index := FindString(function(s : string) : Integer
begin
Result := sla.IndexOf(s);
end);
ShowMessage('Index: ' + IntToStr(Index));
//Call the FindString method with anon method
//to get the count of a searched string
Count := FindString(function(s : string) : Integer
var
str : string;
i : integer;
begin
Result := 0;
for str in sla do begin
if str = s then
Inc(Result);
end;
end);
ShowMessage('Count: ' + IntToStr(Count));
finally
sla.Free;
end;
end;
Please note that this example probably won't make it in the daily code, but it shows in a simple manner how they work. Because of the fact that our anonymouse method can take any method as long that it has a string as parameter you can call one method FindString with different implementations by passing different methods.
Well I think anonymous methods are cool. Implement them in your daily code wisely is not that simple. The working however, which seems magic at first, is after some exploring not that hard to follow.
Monday, October 20, 2008
Round the table Podcast@Delphi.org
The 11th Episode on the the podcast @ delphi.org dicusses some interesting things like anonymous methods, Garbage Collection ("To Dispose() or not to Dispose() ) and the speed of the TStringbuilder.
Great stuff! Enjoy!
Monday, October 06, 2008
Speculating on .NET plans #3
Marco Cantu was the first to blog about this statements, soon followed by Bob Swart, and Tim Anderson.
But no official statement yet! As it looks the official announcement will be made during the PDC Conference by the end of this month. (According to Allen Bauer's blogpost)
What we know now is that Delphi Prism will be a Visual Studio plugin, which I think is great news. As you might know I speculated somewhat over the Delphi .NET (That was the former name of the product) roadmap in previous blogposts, here(#2), here and here. Looks like my speculations were pretty accurate. :-P
I guess this will be the end of the speculation part although there are much questions unanswered, which I am sure will be answered in the near future.
Tuesday, September 30, 2008
A simple Generic Dictionary: TDictionary
A new generic type in Delphi 2009 is TDictionary. TDictionary offers a way to store values based on a key into a list. TDictionary is declared as TDictionary<TKey, TValue>.
TDictionary in fact is what a hashtable is in C#. It allows you to store/structure data based on any key type and any value type.
Suppose we want to track our persons, from the previous blogpost, on their social security number, we could put them in TDictionary like this: (using a very simple social security number....)
procedure TForm4.Button2Click(Sender: TObject);
var
Dic : TDictionary<Integer,TPerson>;
p : TPerson;
i : integer;
begin
//Create dictionary
Dic := TDictionary<Integer,TPerson>.Create;
Dic.Add(1, TPerson.Create('Delphi', 'Mr'));
Dic.Add(2, TPerson.Create('Generic', 'Bill'));
Dic.Add(3, TPerson.Create('nonymous', 'An'));
try
//Travel the strings
for p in Dic.Values do begin
ShowMessage(p.FullName);
end;
//Travel the keys
for i in Dic.Keys do begin
ShowMessage(IntToStr(i) + ': ' +
Dic.Items[i].FullName);
end;
//Find some key
if Dic.TryGetValue(3, p) then begin
ShowMessage('Found it!: ' + p.FullName);
end;
finally
for p in Dic.Values do
p.Free;
//Also free Values and KeyCollection
//other wise you have a memoryleak
//Is this a bug?
Dic.Values.Free;
Dic.Keys.Free;
//Free the dictionary
Dic.Free;
end;
I noticed that if you free the Dictionary in above scenario you must also free the Values and Keys collection to avoid a memory leak. This looks like a bug to me. (Will investigate this further)
In this sample I used an integer type as the key value, so this has not much benefit compared to an array. You can however use any type to be the key value!
Because we can store any type, we can take this a step further and put a TList<T> in our Dictionary:
Suppose we want to put our Personlist into a dictionary based on, let's say their gender. You could do that something like this:
type
PersonKind = (pkMale, pkFemale);
procedure TForm4.Button3Click(Sender: TObject);
var
Dic : TDictionary<PersonKind,TList<TPerson>>;
MPersonsList : TList<TPerson>;
FPersonsList : TList<TPerson>;
pList : TList<TPerson>;
p : TPerson;
begin
MPersonsList := TList<TPerson>.Create;
FPersonsList := TList<TPerson>.Create;
Dic := TDictionary<PersonKind,TList<TPerson>>.Create;
try
//Fill male list
MPersonsList.Add(TPerson.Create('Delphi','Mr'));
MPersonsList.Add(TPerson.Create('Generic','Bill'));
MPersonsList.Add(TPerson.Create('Nymous','Ano'));
//Fill female list
FPersonsList.Add(TPerson.Create('Delphi','Mrs'));
FPersonsList.Add(TPerson.Create('Nymous','Anna'));
//Add to dictionary
Dic.Add(pkMale, MPersonsList);
Dic.Add(pkFemale, FPersonsList);
//Travel
for p in Dic[pkMale] do begin
ShowMessage('This is a man: ' + p.FullName);
end;
for p in Dic[pkFemale] do begin
ShowMessage('This is a female: ' + p.FullName);
end;
finally
//Free Persons and Personlist
for p in MPersonsList do p.Free;
for p in FPersonsList do p.Free;
MPersonsList.Free;
FPersonsList.Free;
Dic.Free;
end;
end;
TDatadictionary is a very powerfull, yet in basic easy to use, generic type. It allows you to build simple, but also complex data structures. (What about a TDictionary with TDictionary's in it? ;-) )
Again a very nice language addition to Delphi!
Thursday, September 25, 2008
A simple Generic List: TList<T>
Delphi 2009 has support for generics, and has 'built in' generic types like TList, TArrays etc. If you want to use them you must add Generics.Collections to your uses clause.
Generic List: TList
Suppose we want a list with persons representing the TPerson class:
// Our class TPerson
type
TPerson = class
FFirstName : string;
FLastName : string;
private
function GetFullName: string;
published
public
constructor Create(ALastName : String;
AFirstName : string);
property FirstName : string read FFirstName
write FFirstName;
property LastName : string read FLastName
write FLastName;
property FullName : string read GetFullName;
end;
//Define the generic list
PersonsList : TList<TPerson>;
//Method to fill the list
procedure TForm4.btnPopulateClick(Sender: TObject);
begin
//Filll the personslist
PersonsList.Add(TPerson.Create('Delphi','James'));
PersonsList.Add(TPerson.Create('Generic','Mister'));
PersonsList.Add(TPerson.Create('Anon', 'Method'));
//etc.
end;
//Traveling this list to fill a TListBox
procedure TForm4.FillListBox;
var
p : TPerson;
begin
ListBox1.Items.Clear;
for p in PersonsList do begin
ListBox1.Items.Add(p.FullName);
end;
end;
As you can see, no rocking science needed to implement a generic list!
Sorting a generic TList
The next step is to implement a sorting method to sort the list on, for example, the Lastname property.
A TList has a Sort property which has an IComparer interface that can be implemented like this using an anonymous method:
(You will have to add generics.default to your uses clause)
procedure TForm4.btnSortClick(Sender: TObject);
begin
PersonsList.Sort(TComparer<TPerson>.Construct(
function(const Item1,Item2:TPerson): Integer
begin
Result :=
CompareText(Item1.LastName, Item2.LastName);
end));
end;
Generics is a great new feature of Delphi 2009. Just as in C# you will use them all the time. In this context, the use of anonymous methods is great.
Besides TList Delphi has more standard generics typs including TArray, TEnumarable and more, so there is always more to explore!
Update 25-09-2008 10:58
As animal commented you must of course create the list first, which I did not include in the code snippets.
PersonsList:= TList
And you will have to free it also at sometime. (Don't forget to free the TPerson objects as well!)
for p in PersonsList do begin
p.free;
end;
PersonsList.Free;
Monday, September 22, 2008
"Cast on News" episode at Delphi.org
Last Friday I had a really fun experience, because Jim McKeeth invited me to be on the sixth episode on The Podcast at Delphi.org - "Cast on News."
Also invited were marc hoffman from Remobjects, and Jolyon Smith from the Te Waka o Delphi blog. Together with host Jim McKeeth we talked about the new Delphi 2009 and Delphi in general. It turned out to be a good and fun talk.
'Speaking up' instead of 'Writing up' is a total different experience, I can tell you now ;-). Make sure you don't miss it, you can 'hear' this podcast on the Delphi.org website.
Sunday, September 21, 2008
Those tiny little details...
Tuesday, September 16, 2008
Delphi 2009 very first impressions
1. Installation
Installation improved a lot! Installing Delphi 2009, so not C++ Builder, only took 13 minutes.
The installation of the documentation, which is a separate install took about 17 minutes.
2. First startup
Start up time (cold) is on my machine approx. 10 seconds. A warm start however only takes 6 seconds. (Personally I don't care a lot about startup times, at least as it does not take too long ;-), but is a nice measure point)
My machine: Intel Core 2 duo 1,86 Ghz. 2GB Ram, Windows Vista Business.
So the installation experience is a lot better then before. (remember > 1 hour installations...).
For my real projects I will have to wait for Devexpress, who are now working on Delphi 2009 support, before I can upgrade, but I guess until then there is a lot to explore.....generics, unicode....etc. By the way, Dr Bob has this nice overview with lots of blogpost and resources about Delphi 2009.
Use an image as your UIBarButtonItem
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
How to get, for example, all the hyperlinks from a webpage, which is loaded in your iPhone app using the UIWebView control? (Xcode's web...
-
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
In ASP.NET it is easy to set the prefered authentication method in the web.config file. For external websites this is set mostly to Forms ...