Direkt zum Hauptbereich

Posts

Es werden Posts vom Februar, 2017 angezeigt.

Introduction to Design Patterns (1): The Lazy Getter

The Laze Getter pattern Example for Java Example for Lazarus and language hint The term "Lazy Getter" refers to the Java vocabular, where a Getter is a method, that returns a feedback value or object. And lazy means, that the effect of this Getter method is somehow delayed. Some more precise, it is delayed until one need it. But what do we need? An object, of course! So we need an instantiation of an object delayed. or maybe we don't need this object at all and this is, why we are using a Lazy Getter. To save resources, it is inevitable to not create the maybe required object at startup. But of course we need to create it, when it is needed. To reach this, the Lazy Getter method is used as a synonyme for the late created object in the source code. This method does nothing else than looking, if the object is created - if yes, then return it - or not - then create and return it. That's all. A simple basic pattern. Example for Java: // somewhere you have de...

CREATE DATABASE via ODBC

When using ODBC, there are some facts to be considered. One of these facts is good to know when one is about to create a new database with an ODBC connection. General you should avoid ODBC if possible. But in some cases this is not possible because ODBC is still the only connection you have. This can happen if you use (for example) Mircrosoft Access to connect to a MySQL Server or a similar scenario. If you already worked successfully with data on that kind of connection, but now you have to create a database, there will occur a problem. Oh the existing connection you usually will have no success when trying to create a database because you maybe dont have the privilege. But even if you have, there will occur a problem.