Tag: programming

No Future for Us to C

It has been a while since some official documents produced by the USA administration advised against using unsafe programming languages like C and C++ (yes, C and C++ are explicitly mentioned). Now, the news resurfaced on the web with an added deadline—manufacturers have until January 1, 2026, to create a memory-safe roadmap for existing applications.

Let’s have a look at the text:

Recommended action: Software manufacturers should build products in a manner that systematically prevents the introduction of memory safety vulnerabilities, such as by using a memory safe language or hardware capabilities that prevent memory safety vulnerabilities. Additionally, software manufacturers should publish a memory safety roadmap by January 1, 2026.

This is pretty strict, even if it is phrased with “should” and not “shall” or “must”. If you develop a new product, you’d better drop C or C++. Moreover, if you have an existing product written in one of these pesky languages, you should provide a roadmap to memory safety.

Continue reading “No Future for Us to C”

Lambda World 2024

It was 2019 and nothing suggested that 2020 would not have been another regular year – another spring, another early bird ticket for the Lambda World conference, another regular summer, and then the most awaited conference of the year, a journey to Cadiz to attend Lambda World 2020.

Things went quite differently (for those reading from other planets – because of the pandemic) and the world was suddenly locked down, some conferences went online, and some were canceled, Lambda World included. Things went a bit better in 2021, but no news about a new edition of the functional programming conference. It was 2022, and many conferences had returned to the in-presence format, maybe with some precaution, but the worst part of the pandemic was finally over. Again no trace of Lambda World. 2023 came and went, and still no sign of lambda-life from Cadiz. Still vague or no answer to my emails to the organizing company.

And then suddenly and unexpectedly, the email popped up in my incoming folder – early bird ticket sale for Lambda World 2024 is open. I was so happy they were back, but at the same time I was about to change jobs and it was not the best approach to arrive on the first day at the new workplace and pretend to be sponsored to attend the conference. So, after a brief family check, I decided to self-sponsor my attendance and hope for at least some partial refund.

Continue reading “Lambda World 2024”

Fun with Functors in C

C language is old, actually, a very old language that resisted all the innovations that impacted the software development industries. Even ISO standard Cobol integrated object-oriented capabilities in 2002!

This didn’t prevent programmers from applying object-oriented programming to C. With some macro juggling and a lot of self-control not to break framework rules, you can have inheritance and dynamic dispatching.

Generic programming is, in the same way, foreign to C language1. You can use preprocessor macros to implement generic containers or functions that can be instantiated on the type you need, but it is a painful endeavor.

Continue reading “Fun with Functors in C”

Unidiomatic Solutions and Technical Debt

Jung’s Synchronicity theory is as fascinating as unscientific. It is “unscientific” because it can’t be proven false by its very own definition – two events appear to be related even if the causal relation is missing. Someone talks about dreaming of a Golden Scarab and suddenly a Golden Scarab hits your window. There is no apparent causal relationship, yet the event pair is so unlikely that the Synchronicity idea has been developed around this. My rational mind is more inclined in thinking of this as a selection bias (countless times it happens something like – you spend a few days away in a city and suddenly the news is filled with stories about this city). Nonetheless, when it happens I always feel uneasy, like the Universe would like to have a word with me.

So when I read the tweet below, by Mario Fusco, in a quite specific job timeframe, I felt called out

Tweet by Mario Fusco

In my whole professional career, I always tried to push the boundaries of the language(s) I was using, from assembly to C++, to achieve better engineering, more robust and safer code, fewer bug opportunities, simpler development, and improved collaboration. This meant sometimes introducing the latest C++ standard, sometimes introducing concepts from other languages and sometimes defining DSL with the help of the preprocessor. So I am not new to some raise of eyebrows when people look at my code.

Continue reading “Unidiomatic Solutions and Technical Debt”

Surprisingly Exceptional

It all starts in schools. When they teach you how to program a computer. You get plenty of code that just works in the happy path scenario. So happy path that there are no other paths at all.

And then it is easy to grow, line of code after line of code, with the idea that error handling is not really part of the code. Elegant code has nothing to do with errors. Could be a sort of brainwashing.

And then language designers, present you the ultimate error-handling solution – lo and behold the Exceptions!

You can still write the code the way you were taught and then when something bad happens, throw an exception. A flare fired in the sky, in the hope that some alert patrol on guard could spot and come to the rescue.

Continue reading “Surprisingly Exceptional”

Speak Slowly, no Vowels, pls – Solutions

In my previous post, I described how I devised a programming problem for an internal company contest with the help of the ubiquitous ChatGPT. Also, ChatGPT provided a solution for the problem as part of the development process. Even more interestingly the language model provided a fictional context for justifying the problem.

The task was to write a function removeVowels( string text ) which takes an arbitrary text (arbitrary as long as it contains no uppercase letters) and returns the same string where vowels have been removed. Given the string “hello world”, the result should be “hll wrld”.

The implementation must not have:

  • loops
  • if statement
  • list comprehension

If you want to give it a try before reading the solution, stop here. Otherwise, follow me.

Continue reading “Speak Slowly, no Vowels, pls – Solutions”

Speak Slowly, no Vowels, pls – The Problem

As a winner of the last programmer contest at Schindler MIL, I had to devise a new compelling and intriguing puzzle to propose to my colleagues. The first two puzzles were in the form “Implement X without using Y“, an interesting pattern that allowed for multiple solutions.

But I ran short of (X,Y) pairs, and staring at my blank page I decided to resort to … ChatGPT. Yes, nowadays it is like the uber-solution to everything. Don’t you know how to partially specialize your templates? Ask ChatGPT; don’t you know how to present a topic? Ask ChatGPT; don’t you know how much a brick weighs? Ask ChatGPT; don’t you know how to devise a programming puzzle? Ask ChatGPT.

So I went on and asked this modern oracle –

Continue reading “Speak Slowly, no Vowels, pls – The Problem”

Classy Enums

Back in another era, when I worked for UbiSoft, my then-boss Alain, started a wonderful initiative – the Technical Meeting. Every Friday afternoon, one of us should present a technical argument to the whole team. A good number of Technical Meetings were held, but when the project entered some frantic period. I have fond memories of these meetings.

So I was very happy when I heard that a similar initiative was going to happen at Schindler – the biweekly Technical Session. The idea is very similar – every two weeks one of the colleagues volunteers to make a short technical presentation and give it to the team. Topics are diverse, mainly related to C++. The goal is to have compact presentations limited to 10-15 minutes, ideally including some hands-on parts.

I volunteer for the second topic, which in turn I’ll present here.

Continue reading “Classy Enums”