Timeline - Delphi Workshop

Thumbnail

| 2015-08-05 00:00

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-06-26 20:56

A few weeks ago I learned about Knockout.js which is a very lightweight JavaScript MVVM library. It contains of some basic features which you can read about on their home page if you are interested. I quickly was amazed how great their concept of observables works (I love design patterns on steroids). However JS is very different from Delphi code so my first version had them declared like this: type IObservable<T> = interface function GetValue: T; procedure SetValue(const value: T); property Value: T read GetValue write SetValue; end; So working with them looked like this: var o: IObservable<Integer>; begin ...…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-05-07 19:17

Today we got the request to support TInterfacedPersistent in the DI container. As you may know TInterfacedPersistence does not do reference counting like TInterfacedObject does - or to be more precise it delegates it to its possible owner. Usually the owner will be nil so it does not do reference counting through its _AddRef and _Release method and often is used for classes that should not do reference counting if you don't want to write your own class (or use Spring.TInterfaceBase for that purpose). When working with DI your life will be much easier when using interfaces. But if the…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-02-21 17:46

With all these articles and presentations about the PPL you might have seen this often. Calling TThread.Queue (or TThread.Synchronize if you are doing it wrong ;)) to execute your VCL or FMX related code in the main thread. Are you still typing this code wasting precious time? Well then this article is for you! I see this so often in presentations by people that should know better given their many years of Delphi experience. And to be honest - I am guilty of that too. I could spend way less time writing stupid code (with stupid code I usually refer…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-02-21 15:53

Recently Robert Love blogged about Exception Management in the PPL (let's please stick to this abbreviation since that is what Embarcadero calls it). What I was missing though was handling exceptions in fire and forget tasks since you usually don't have some place that calls wait on them just to get the exception being raised. So I quickly hacked together some stuff to show how to use a feature from the TLP (that's the .NET one): ContinueWith. From its documentation: Creates a continuation that executes asynchronously when the target Task completes. Easy enough. We got all the pieces to create…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-02-07 14:46

The time of teasing is finally over - today I want to show you what I have been working on over the past few weeks: TestInsight is an IDE plugin for Delphi (supporting XE and up) that will improve your unit test experience. It integrates nicely into your IDE removing the necessity to deal with some external test runner. It runs and presents the results on demand, when saving or continuously whenever you change the code. Navigating to any test is just a matter of double clicking the test in the results overview. As I would like you to experience…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-01-29 22:18

Today I want to talk about dynamic arrays. Often you might prefer them over a full blown generic list because it avoids creating an instance just to store a couple of elements (which are backed by a dynamic array inside the list anyway - at least for a regular TList<T> regardless if you use those from the RTL or the Spring4D ones). But they are tedious to use even with the additional syntax support in Delphi XE7. There are other implementations that improve dynamic array usage that work even for older versions. Spring4D will introduce the new DynamicArray<T> type which…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-01-25 12:52

In a previous post I talked about the Maybe type that similar to the Nullable type allows you to handle values or the state of having no value in a functional approach. Today I show you another type that is common in functional programming - the Either type. It allows you to return 2 different types from one function. This could be for example the content of a web request or an error message. In our example we are using similar code as in the previous post and return the result of a division or an error message. Here is…

Thumbnail

noreply@blogger.com (Stefan Glienke) | 2015-01-21 00:02

I admit - such headlines are getting old - at least for those that know a bit about functional programming. But for those of you not familiar with the term monad it might be new. But don't be scared though by all that functional programming gibberish in that Wikipedia article. Today after Nick's heretical post about avoiding nil we had quite some discussion in the Spring4D team. Because given you must not use nil - how do you deal with the state of none in your code? The business logic might define that a valid result is zero or one…

Page 136 of 144

```