Thursday, June 06, 2019

Monday, April 29, 2019

Spring4D European Conference 2019 sessions

Slides and code for the Spring4D conference are now published on the conference page.

Slides and code for my two sessions – Design patterns with Spring4D and Interception and dynamic proxy – are also available on my presentations page.

Saturday, April 27, 2019

FastMM4 large memory allocation–benchmarking VirtualAlloc

Earlier this week a long-time customer asked me why FastMM allocates large memory blocks from the top of the memory and if that option could safely be turned off. Their reasoning was that such allocations are much slower than normal ones. The question surprised me as I didn’t know of any such difference in speed so I did what I usually do–I wrote a benchmark application and measured it.
TL;DR Yes, allocating from the top is slower. No, the difference is not big and in most cases you’ll not even notice it.
There were, however, other interesting results that my simple benchmark pointed out. More on that in a moment, but first…

Thursday, April 18, 2019

Books, books, books

Dear reader,

You probably know that I write books. A big part of making a book, however, is not just writing it, but letting all the potential readers out there know that the book exists. I'm doing a lot there - and so is my publisher - but still we can't reach all the potential readers ourselves.

That's where you come in!

If you have read any of my books and if you loved it and want the others to know, please consider publishing a review on the Amazon site. More reviews make Amazon algorithms treat the book with more respect and they recommend it more to customers.

Leave the review here: Delphi High Performance, Hands-on Design Patterns with Delphi.

You can also just tell your colleagues in any social circle - digital or real-life - that you like the book. Spread the word!

If you think that is too much and you don't want to get involved so deep, it doesn't matter. I still love you.

On the other hand, if you didn't like my book, let me know. I want to improve, so tell me why you don't like it and what I can do to make my next book better. My contact info is here.

Thank you,

Primož

Monday, April 08, 2019

Deep Dive into Design Patterns

Hands-On Design Patterns with Delphi Book CoverWhile writing Design Patterns with Delphi, I spent quite some time researching existing literature on design patterns implementation in Delphi, design patterns in other languages, other types of patterns, design principles and so on …

In case you would like to dig deeper than the book takes you, here is my reading list.

Tuesday, March 26, 2019

Spring conference, spring edition

Hurry up, you only have five (5) days left to get a Spring4D European Conference ticket at the regular price!


Spring 4D Logo


It’s gonna be a blast! Stefan will be there, of course (can you imagine Spring 4D without him in the picture?), and so will be I. There will be a ton of interesting sessions, and lots of time for eye-to-eye discussions. Marco has announced his presence, I’ll be bringing my books (or you can bring your own copy, if you already own it and want it signed), Stefan will be accepting musical requests (not really ;) ) …

You can join us for a day or two. Your call, but I would certainly recommend the latter, because this conference will ROCK!

“Bee there Orr Bee A Rectangular Thyng
- The Band With Rocks In *

Friday, March 08, 2019

Delphi developer needed (Slovenia)

Slovenian company BASS is looking for a Delphi developer (on-site in Celje, Slovenia).

(I’m not affiliated with them; they just asked me to spread a word around. If you have any questions, contact them directly.)

Wednesday, February 27, 2019

Design Patterns with Delphi (book)

Hurrah, hurray, my third book is here! It’s called Hands-On Design Patterns with Delphi and (just like my first book) I wrote it for Packt Publishing. (The second book was self-published and I expect the fourth one to be, too.)

As the name says, “Design Patterns with Delphi” deals with design patterns. It is a bit different from most of design pattern books and websites you will find on the Internet. Case in point A: There are no UML diagrams. I don‘t speak UML. Tried to learn it few times but for some reason the whole concept doesn‘t agree with me. If you like diagrams, don’t fear though. Any book on design patterns - and most websites covering that topic - will gladly show how any design pattern can be diagrammed. That, however, is not important and should not govern your decision to buy the book.

More important is case in point B: This book speaks Delphi. All the examples are written in Delphi and language features are used to the full. I also covered few less known Delphi idioms in separate sections. You’ll still be able to follow the discussion even though you may program in a different Pascal dialect.

There’s also case in point C: Examples make sense. I deeply dislike classical design pattern examples of the “And then we want to write this program for different toolkits and it should also be able to draw circles, not only squares” kind. Euch! I tried to find a good example for each design pattern. Admittedly, I ended with few examples that draw triangles and squares on screen (mostly because some patterns were designed specifically for solving such problems), but most of them are of a more practical nature.

This book covers all three classical design pattern categories - Creational patterns, Structural patterns, and Behavioral patterns. It also discusses patterns from the newer Concurrency patterns category. At the end I threw in some borderline-pattern(ish) topics and ended with a discussion of few patterns that cannot be strictly classified as “design” patterns.

In this book you’ll find:

  • Chapter 1

    An introduction to patterns. Exploration of design principles, design patterns, and idioms. A mention of anti-patterns. A short description of most important design principles. Delphi idioms: creating and destroying objects.
  • Chapter 2

    Creation patterns part 1. Singleton. Dependency injection. Lazy initialization. Object pool.
  • Chapter 3

    Creation patterns part 2. Factory method, Abstract factory, Prototype, Builder. Delphi idioms: Assign and AssignTo.
  • Chapter 4

    Structural patterns part 1. Composite. Flyweight. Marker interface. Bridge. Delphi idioms: comparers and hashers.
  • Chapter 5

    Structure patterns part 2. Adapter. Proxy. Decorator. Facade. Delphi idioms: replacing components in runtime. Also: helpers.
  • Chapter 6

    Behavioral patterns part 1. Null object. Template method. Command. State.
  • Chapter 7

    Behavioral patterns part 2. Iterator. Visitor. Observer. Memento. Delphi idioms: for .. in.
  • Chapter 8

    Concurrency patterns part 1. Locking. Lock striping. Double-checked locking. Optimistic locking. Readers-writers lock. Delphi idioms: tasks and threads. Also: bitwise operators.
  • Chapter 9

    Concurrency patterns part 2. Thread pool. Messaging. Future. Pipeline.
  • Chapter 10

    Writing Delphi programs. Event-driven programming. Actions. LiveBindings. Form inheritance. Frames. Data modules.
  • Chapter 11

    Wrapping it up. Exceptions. Debugging. Functional programming.

I hope you will like this book and learn a lot from it. I know I did during the nine months I spent writing it. And if you find any bug in the code, let me know so I can correct it in the second release!

Saturday, February 23, 2019

OmniThreadLibrary 3.07.7

New OmniThreadLibrary is out! Get it while it’s hot!

Version 3.07.7 is mostly a bugfix release. It fixes a stupid mistake introduced in version 3.07.6 plus some other minor bugs.

You can get it now on git, download the ZIP archive, install it with Delphinus or with GetIt.

For more information, visit OmniThreadLibrary home page or write your question on the forum.

Tuesday, January 29, 2019

Caching with class variables

Recently I was extending a swiss-army-knife helper record we are using at work and I noticed a small piece of suboptimal code. At first I let it be as I couldn’t think of a simple way of improving the code – and the problem was really not so big that it should be fixed with a complicated solution. At some point, however, a simple and elegant solution appeared to me and I like it so much that I want to share it with the world ;)