Friday, December 08, 2017

Spring4D presentation slides and more

Slides and code for my Spring4D presentation are now online on the Presentations page.

And to the participants of the workshop, here's the answer I promised.

If you want to catch all calls to some function while mocking, you can pass in Arg.IsAny (or call some other function of the TArg type, defined in Spring.Mocking.Matching).

I have added an example to the Mocking project.

mockCalc.Setup.Returns(4).When.AddTwo(2);
mockCalc.Setup.Executes(
  function(const callInfo: TCallInfo): TValue
  begin
    lbLog.Items.Add('Don''t know how to handle ' + callInfo.Method.Name +
     
'(' + IntToStr(callInfo.Args[0].AsInteger) + ')');

  end).When.AddTwo(Arg.IsNotIn([2]));

Or you can pass Args.Any to the When function. In that case, the argument passed to AddTwo is ignored.

mockCalc.Setup.Returns(-1).When(Args.Any).AddTwo(0);


Monday, December 04, 2017

Advent of Code

Last few days I'm having great fun solving problems from Advent of Code 2017 page and so does my daughter (with a bit of help from her dad). I'm using Delphi and she Python so that's also a good practice to brush my multilanguage skills ;)

Go ahead, take a look at the problems. Some are simple, some not so much, but they are all quite interesting.

All my solutions are posted to my GpDelphiCode repository so you can look at and criticise my code. Most of the solutions depend on units from my GpDelphiUnits repo so you'll need that one too.


Friday, December 01, 2017

In the middle of winter, Spring comes to Ljubljana

Indeed, it is snowing for the last three days. Not much, but winter is definitely here.

To add some green to the white surroundings we'll spend the next Friday talking about spring. Or, actually Spring. For Delphi. Also known as Spring4D - definitely the best Delphi collection of programming goodies that you can find around.

If you speak Slovenian language (sorry, almost all of the world population), you're welcome to my workshop about that ingenious library. If not, you'll have to find that information somewhere else, sorry. Or you can learn Slovenian and come to Ljubljana. Where else can you listen about Delphi in a session targeted to only 2 millions of humans?

Programerji smo včasih malo leni in iščemo bližnjice. Odlične programe bi radi napisali s kar najmanj kode. Pri tem nam pomaga tudi fleksibilnost jezika Delphi in odlične programerske knjižnice.

Tokrat si bomo ogledali knjižnico Spring4D, ki prinaša množico malih pripomočkov in bljižnic za pametne programerje - od objektov, ki jih ni treba sproščati, do razredov, ki jih ni treba inicializirati in seznamov, po katerih se lahko sprehajamo, jih filtriramo, povezujemo in še in še.

Za nameček bomo podrobneje obdelali še tehniko Dependency Injection in si - bolj za zabavo, kot zares - ogledali še, kako lahko v Delphiju s tehniko odzivnega programiranja ReactiveX dogodke obravnavamo čisto drugače kakor smo navajeni.


Izkoristite priložnost in spoznajte kako lahko hitreje napišete odlične programe. Vabljeni v petek, 8. decembra, ob 9.00 uri, v predavalnico Obrtne zbornice Vič.