A Software Development Tip – !!!

When developing code it is a frequent occurance that you write something as a quick “get it to compile” fix whilst your mind is focused on the key part on which you are working.

Let me offer an example. Whilst developing a TCP/IP interface to a set of remote digital and analogue i/o you come across a need for a function to extract a set of characters that are specific within a string. You might quickly write a function with a prototype:

String ExtractSpecificCharactersFromString(String IncomingString);

 In order to keep going on the main code you are writing on you may quickly write a dummy function body:

 String ExtractSpecificCharactersFromString(String IncomingString)
{
  return String(“D0=0xf5c9”);
}

 This allows your code to compile and it retuns a sample data String that allows you to start testing your code, all of which is good!

 But there is a real danger that “dummy” code like this can get left in genuine code for too long. You end up creating your own bug: “I am sure that digital output byte is set to 0xf500, so why does it keep reading as “0xf5c9?”

 Having wasted time as a younger programmer chasing these self inflicted bugs I have adopted a procedure where I reserve a comment statement with three consecutive ’!’ characters specifically for tagging code that is still to be written. For the above example create the function body as:

 String ExtractSpecificCharactersFromString(String IncomingString)
{
  return String(“D0=0xf5c9”); // !!! still to be written
}

 Then at regular “low concentration” moments you can go back to the code and search for the character string ”!!!! in “all project files” (using the Embarcadero C++ search terminology here) and quickly find all examples of dummy code where you know further work is required.

 I chose ”!!!” for this task as it is a string which is exceedingly unlikely to appear in genuine C++ code. Choose something else if you like but whatever you choose stick with it!

 

Advertisements

Embarcadro RAD Studio News – Tokyo Release 3 (version 10.2.3) now out !

 

Embarcadero have announced release 3 of 10.2 Tokyo (i.e. 10.2.3).

 A summary of the new features is given at

Announcement of 10.2.3

 The C++ Rename Refactoring has been in the pipeline for a while now. It’s great that it is finally here!

 There’s also more in depth information at 

 Embarcadero Tokyo Release 3 DocWiki

 

Exciting RAD Studio Developments in 2018

Embarcadero have announced some information about Release 3 of 10.2 Tokyo (i.e. 10.2.3). This release is targeted for the first quarter of 2018.

 For this release they have three key themes. First, to provide enhancements to the core visual frameworks, including better HighDPI support for VCL and quality improvements for FireMonkey (FMX). Second, they are continuing to improve the C++ capabilities, by including CMake command line support and C++ Rename Refactoring. Third, they are expanding RAD Server support for Ext JS.

 We will keep you posted about when this release becomes available.

A tip for using Firemonkey and VCL on different Embarcadero C++ projects

I use Embarcadero C++ for a lot of work. Sometimes Firemonkey is the right framework to use and sometimes VCL is. I have a lot of C++ files that contain classes that are equally useful for both frameworks.

 Instead of having

 #include <fmx.h>

 or

 #include <vcl.h>

at the tops of the files, for all *.cpp files that can be applied equally in either framework, I use the following line:

#include “EmbarcaderoComponentLibrary.h”

The file EmbarcaderoComponentLibrary.h resides in every project I create and is edited once at the start of the project design. It contains the following lines (along with a load of comment statement which I don’t reproduce):

//*****************************************************************

//Set these for each project requirements

#define ROGER_USE_VCL 1

#define ROGER_USE_FMX 0

//******************************************************************/

#ifndef EMBARCADEROCOMPONENTLIBRARY_H

#define EMBARCADEROCOMPONENTLIBRARY_H

#if ROGER_USE_VCL

#include <vcl.h>

 #endif

 #if ROGER_USE_FMX

 #include <fmx.h>

 #endif

 #endif

 //*****************************************************************

 

The First Rule of Software Development

There are many rules that could claim to be the “first rule”…..

 How about:

 “Never have the same data maintained in two different places.”

 If you don’t follow this rule you immediately have a new task of ensuring that the two different places contain the same data and also the headache of what happens when they do contain different data.

 It sounds obvious, but you’d be amazed how many times this rule is violated.

 

Embarcadero C++ Version 2.2.2 is now available

Embarcadero have released their latest version of RAD Studio / C++ / Delphi this week – calling it Tokyo 2.2.2.

One of the new helpful improvements is the addition of a “dark theme” option in the IDE. Many professional developers will be grateful for the reduced eye strain using the IDE configured in this way affords.

 You can find a full list of the new features available at

 V2.2.2 Information about new features

You can download a copy of the starter edition (FOC) at

Embarcadero RAD Studio – Starter edition

 

Embarcadero FireDAC and C++ – Good for Paradox

FireDAC is good for paradox (a leading database in it’s time and still in use in legacy applications)…..

 

1) Create a new VCL project

 2) on Form1 add a single TFDConnection

 3) double click on this TFDConnection

 4) Select DriveID to be “ODBC”

 5) Now in the ODBC Driver entry, can you select “MS Driver for Paradox” ?

6) Assuming you can, enter the full path to your Paradox database directory in the “Database” box

 7) close down the configuration window

 8) go to the properties of the TFDConnection

9) click on “Connected” – this will bring up a password dialog (on our test I have no password protection so just click on OK). The connected check box in the properties should now say “true”.

 10) Now you can add a TFDQuery to your form

 11) It will have the property: connection already set to your TFDConnection

 12) Double click on the TFDQuery to bring up the query editor

 13) in the SQL tab enter the following

   SELECT * FROM yourtablename

 14) click on Execute and you will see all the contents of the table.

 I have just done this with a paradox database on a Win 7 PC using C++ Builder and it all works as described.

 Note: you may want to use the connection wizard (button on the TFDConnection configuration form) as this also sets up ODBC Advanced string which has additional options that can apply to FireDAC ODBC Paradox.

 Hope this helps get you started.

 

Embarcadero FireDAC -10.2 Tokyo – Release 1

Embarcadero have recently released an updated to RAD Studio (C++ Builder/Delphi) called 10.2_Tokyo_-_Release_1

 What do you get in this update?

 * Delphi Linux server performance enhancements for both RAD Server and DataSnap.

* Delphi and C++ compiler and linker updates that resolve issues loading packages, especially when debugging, on Windows 10 Creators Update.

* Support for latest versions of iOS and Xcode (iOS 10.3 and XCode 8.3.2) when targeting the iOS App Store.

* FireDAC support for MSSQL 2012, 2014, 2016, and ODBC Driver 13.

* Significant C++ linker improvements pertaining to linking larger projects.

* Fixes and enhancements to the Runtime Library and VCL.

* Additional Android enhancements around control rendering and performance, and fixes for TEdit issues with Android N.

* FireDAC Support for InterBase 2017 Exclusive Isolation Level and Transaction Wait Time.

* Changes in DataSize for fields of type ftInteger and ftLongWord to avoid using the platform-dependent LongInt and LongWord type (the change affects only 64-bit Linux and 64-bit iOs platforms), and related changes for SetFieldData and GetFieldData

* Fixes for over 140 issues reported by customers in Quality Portal.

 You can get more information and the actual download links for the update at:

 Docwiki for 10.2 Release 1

So what are you waiting for? go get it !