[WayBack] Tech Debt (by MonkeyUser: Software development satire) is one of the best images on Tech Debt I ever encoutered (via[WayBack] Tech Debt by @ismonkeyuser https://www.monkeyuser.com/2018/tech-debt – ThisIsWhyICode – Google+):
–jeroen
Posted by jpluimers on 2019/11/07
[WayBack] Tech Debt (by MonkeyUser: Software development satire) is one of the best images on Tech Debt I ever encoutered (via[WayBack] Tech Debt by @ismonkeyuser https://www.monkeyuser.com/2018/tech-debt – ThisIsWhyICode – Google+):
–jeroen
Posted in Agile, Conference Topics, Conferences, Development, Event, Software Development, Technical Debt | Leave a Comment »
Posted by jpluimers on 2019/11/07
As I will probably need this one day: [WayBack] How does one convert a Delphi enum to a JSON value, with different specific values? – CHUA Chee Wee – Google+:
eg,
TEnum1 = (test1, test2, test3)
TSomeClass.FEnum := test1;When converted to JSON, I’d like to see maybe
{"Enum": "Value1"}instead oftest1and
test2to"Godzilla",test3to"Tiburon"
The solution is in his repository: github/chuacw/EnumJson:
After initially suggesting to look into [Archive.is] Serializing User Objects – RAD Studio, he based his solution on a set of clever tricks circumventing Delphi compiler limitations and bugs:
TEnumInterceptor<T> from [Archive.is] Data.DBXJSONReflect.TJSONInterceptor and put the conversion logic in thereTEnumInterceptor<T> because of a compiler limitation and bugData.DBXJSONReflect.JSONReflectAttributeLater he extended the solution to include sets in additions to enums: [Archive.is] Persisting enumeration and sets to JSON – Chee Wee’s blog: IT solutions for Singapore and companies worldwide (via [Archive.is] Made my JSON interceptor demo public. Now you can save your enum and sets to JSON, with customized output to boot! – CHUA Chee Wee – Google+)
Clever!
Hopefully this got Lars Fosdal some ideas to solve [WayBack] JSON in Berlin – Can I persuade TJSon to treat “params” as it was a string and not an object for the TJsonRPC class? – Lars Fosdal – Google+
Enums with Delphi and their mapping is a repeating topic, see for instance [WayBack] What’s the easiest (ie., least coding) way to map an enum to a const string and vice versa? (Can attributes be used on enum values yet?) eg., type TMyColor… – David Schwartz – Google+
It shows how much the Delphi language is in need of language enhancements as right now there are way too many open source libraries struggling with the same issues each working around them or providing solutions in slightly different way.
Three things immediately come to mind:
Some examples of libraries providing enumeration support:
TEnum class with static methodsTEnumeration class with static methodsEnum.Wrapper unit with various records mimicing .NET behaviour based on David’s workSome more thoughts from a different perspective: [WayBack] What’s New in Edge Rails: Active Record enums
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/17
Still wrongly documented as System.Exit Function [WayBack], most people think it is a statement.
However, it is a compiler intrinsic procedure in the System unit that – when called inside a real function – optionally accepts a parameter with the same type as the encompassing function because it is a compiler intrinsic. It kind of acts as an overloaded procedure, but in fact translate to machine code via an intermediate parse tree.
The parameterless version has been there since at least Turbo Pascal 3.0, but the parameterised version is more recent: I think it was introduced around Delphi 7.
It then stops executing that function after first executing any explicit or implicit finally blocks.
I’ve seen various projects that used their own
Exitprocedure. This is a very bad habit: Since theSystemunit is always further away in scope, the introduced one is called which can severely confuse programmers not being aware of this.
The code generation for the parameterless and parameterised “overloads” of System.Exit is slightly different:
Stefan Glienke explained the above in [WayBack] The advantage of using Exit() instead of a plain Exit? You can place a breakpoint! – Uwe Raabe – Google+
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »
Posted by jpluimers on 2019/10/17
As a follow up of SSCCE, MWE and MCVE are basically the same: provide code people can use to reproduce a problem, I found [WayBack] How to debug small programs which is starts as
One of the most frequent categories of bad questions I see on StackOverflow is: I wrote this program for my assignment and it doesn’t work.
[20 lines of code].And… that’s it.
Then it goes on how to debug those pieces of code, trim them into an SSCCE/MWE/MCVW to form the base of a question which you can ask on StackOverflow/SuperUser/ServerFault/StackExchange, forum, group/community or even your co-worker.
The really cool thing about the techniques used there are that they also apply to bigger pieces of code, heck even large code bases.
They force you to trim down your problem in to manageable pieces that are easy to explain and write concise documentation and tests around them to assist you in the process.
Below are the steps in a short list. Be sure to read the original article How to debug small programs | Fabulous adventures in coding after going through the list.
This sounds like a lot of work. It is. All good programming is.
If you apply these before writing any logic code, then your life becomes easier because you will spot bugs sooner:
Does this again sound like a lot of work?
Then remember: taking a shortcut will make the actual work longer. The reason is that hunting for bugs is a tedious and time consuming process scaling very badly with complexity.
–jeroen
Posted in Conference Topics, Conferences, Debugging, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/16
Many times I see people asking questions about problems in their source code, it goes like this:
If you have such questions (I still often have them), then you need to do just two things (which you often can combine in one step):
The second is called Rubber Ducking after a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck.
The first is known under at least three terms:
SSCCE: Long but very explanatory summarised by”Describes the short, self contained, correct example. A useful technique for debugging.”MWE: Short but not very descriptive, but has some good links to background materialMCVE: good mix between the two; long enough but still readableThey all come down to the following:
Provide a small piece of working code that is readable anyone can use to reproduce a problem without much effort.
via: Can we create a Help Center topic that outlines what a SSCCE / MWE means for Stack Overflow?
–jeroen
Posted in Conference Topics, Conferences, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/15
Apart from blank and custom labels, Brady also sells [WayBack] Brady Printed Lean Labels | BradyID.com
They work great for agile projects, despite marketed as “will help you improve reliability, up-time, and efficiency”.
I found them via:
which led me to [WayBack] Sprints, marathons and root canals, which is a long but recommended read.
That got me to a book that is now on my reading list: [WayBack] James Shore: Agile-Book, especially this chapter:
[WayBack] James Shore: The Art of Agile Development: Iteration Planning
Assorted sets of stickers are (all in packs of 10 each):
![]()
![]()
[WayBack] Brady Part: 110763 | Assorted Reliability Stickers
Though you can also get them individually in 10 packs:
Posted in Agile, Conference Topics, Conferences, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/10
Great introduction into functional programming by a step by step: “Why Functional Programming Matters”, by Ted Neward on Devoxx Poland 2016.
It uses Java, but translates very well into C#, C++, Delphi and many other programming languages because the underlying support structures are very easy (a ~50 line Lists class, a few Function# prototypes, etc).
Two great observations here:
Summary
Coding Tech
In the latter half of the 2000s, a new kind of programming language seemed poised to take the steam out of the dominancen of object-oriented programming languages and their hold over “mainstream” development. But these new languages, collectively referred to as “functional” languages, were nothing new. In fact, they’ve been a part of the language landscape since the late 80s, and arguably even longer than that. What makes a functional language, and what makes a functional language interesting? Most importantly, why do we care now, thirty years after their introduction?
–jeroen
Posted in Conference Topics, Conferences, Development, Event, Functional Programming, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/08
For my link archive:
The first one missed these:
Both find these:
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, SOAP/WebServices, Software Development | Leave a Comment »
Posted by jpluimers on 2019/10/03
On my Delphi research list:
[Window Title] Error [Content] Error creating form: Root class not found: "". [OK]
I think it has to do with form inheritance, but a quick glance didn’t raise any warning signs.
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 1 Comment »
Posted by jpluimers on 2019/10/02
I got an interesting question a while ago: should an application terminate (anonymous) threads or not?
Started.WaitFor might not return (which you cannot get around this because all overloads of the CheckThreadError are non-virtual)A problem is that a thread might not execute unless you call WaitFor before Terminate is called. The reason is that the internal function ThreadProc does not start Execute if the thread is already terminated.
The
ThreadProcin theSystem.Classesunit is an ideal place to set breakpoints in order to see which threads might start.Other useful places to set breakpoints:
TAnonymousThread.ExecuteTExternalThread.Execute
Execute not being called by ThreadProc is a bug, but it is not documented because QC is gone (taking the below entry with it), it is not in QP and the docwiki never got updated.
Given QC has so much information, I am still baffled that Embarcadero took it down.
Sergey Kasandrov (a.k.a. serg or sergworks) wrote in [WayBack] Sleep sort and TThread corner case | The Programming Works about this bug and refers to WayBack: QualityCentral 35451 – TThread implementation doesn’t guarantee that thread’s Execute method will be called at all .
The really bad thing are the WayBack: QualityCentral Resolution Entries for Report #35451 Resolution “As Designed” implying the design is wrong.
In his post, sergworks implemented the Sleep sorting in Delphi. Related:
- WayBack: Genius sorting algorithm: Sleep sort
- [WayBack] Reddit – 4chan: Sleep sort : programming
- [WayBack] 4chan: Sleep sort : programming
- [WayBack] Sorting algorithms/Sleep sort – Rosetta Code
- [WayBack] What is the time complexity of the sleep sort? – Stack Overflow
Note that application shutdown is a much debated topic. Best is to do as little cleanup as possible: your process is going to terminate soon anyway. No need to close handles or free memory: Windows will do that for you anyway. See for instance:
- [WayBack] The old-fashioned theory on how processes exit – The Old New Thing
- [WayBack] Quick overview of how processes exit on Windows XP – The Old New Thing
- [WayBack] Changes to power management in Windows Vista – The Old New Thing
- [WayBack] Now that Windows makes it harder for your program to block shutdown, how do you block shutdown? – The Old New Thing
- [WayBack] A process shutdown puzzle – The Old New Thing
- [WayBack] A process shutdown puzzle: Answers – The Old New Thing
- [WayBack] A process shutdown puzzle, Episode 2 – The Old New Thing
- [WayBack] Why does Internet Explorer not call DLL_PROCESS_DETACH on my DLL when I call ExitProcess? – The Old New Thing
- [WayBack] When DLL_PROCESS_DETACH tells you that the process is exiting, your best bet is just to return without doing anything – The Old New Thing
- [WayBack] Why can’t I delete a file immediately after terminating the process that has the file open? – The Old New Thing
- [WayBack] During process termination, the gates are now electrified – The Old New Thing
- [WayBack] How my lack of understanding of how processes exit on Windows XP forced a security patch to be recalled – The Old New Thing
- [WayBack] The old-fashioned theory on how processes exit – The Old New Thing
- [WayBack] Some reasons not to do anything scary in your DllMain – The Old New Thing
Related to waiting:
Related to executing:
–jeroen
Posted in Conference Topics, Conferences, Delphi, Development, Event, Multi-Threading / Concurrency, Software Development, The Old New Thing, Windows Development | Leave a Comment »