Category Archives: Meetup

C++ London Meetup: Pointers and Errors

This C++ Meetup, held at Skillsmatter, was split into two talks.

The first by Ervin Bosenbacher was Modern C++ Smart Pointers in C++ 17, 20 & Beyond. It served as a good introduction to smart pointers and motivation for using them, particularly for developers new to C++ (or those who had not yet started to use C++11). The talk covered:

  • Issues with use of raw pointers (ownership, how to delete, exception safety)
  • std::auto_ptr and why not to use it
  • std::unique_ptr and std::shared_ptr – trade-offs and performance figures
  • Use RAII – assign a raw pointer to a smart pointer as soon as it is allocated

A good point was that use of std::shared_ptr means that other parts of the codebase can modify an object that you’re sharing – so synchronisation primitives (such as a std::mutex) are needed to ensure access to the underlying resource is thread-safe. This is often overlooked because the reference counting *is* thread-safe. In C++20, we will get atomic smart pointers to help with this.

Discussing std::shared_ptr with a friend, I also learnt about a secret constructor on std::shared_ptr to share the resource control block and keep a parent pointer alive.

The second talk was Arno Schödl on Error Handling. He described how Think Cell grade errors into different levels, each with a clearly defined error handling strategy. The aim is to minimise coding and testing overhead whilst maximising the ability to capture and debug error conditions.

Leave a comment

Filed under C++, Meetup, Programming

IET Meetup: Debugging the Brain


In 2011, Ed Boyden won the IET Harvey Prize in recognition of his contribution in the field of optogenetics. Now some years later, he came to the IET to update the organisation on the progress his team have made in that field and how their contrarian approach has led to developments elsewhere.

The field combines light-based optical technologies and genetics to control the activity of neurons, enabling treatment of conditions resulting from a wide variety of brain disorders, such as epilepsy, post-traumatic stress disorder, and Parkinson’s disease.

Boyden described novel techniques, such as repeated miniaturisation of structures by injecting a lattice and using dehydration of hydrogels. This was discovered by reversing a process performed to increase the scale of neutrons in brain tissue so they could be visualised for research projects.

Marquee events like this are always very popular at the IET and this one was was very well attended. What was particularly notable was the number of well-informed questions after his presentation from researchers in similar fields who had travelled to attend the event.

Leave a comment

Filed under Meetup

IET Meetup: Appleton Lecture – AI and Human Digitization


The first address in this year’s Appleton lecture was given by Dr Sarah Atkinson. She gave a historical view of “fake news” created by manipulation of media, starting with the Cottingley fairies. This set the scene for Dr Hao Li’s excellent presentation of his research into animation of people, initially through long-running processes for film effects, but latterly in real-time for Animoji on the iPhone X.
Dr Hao Li - Animoji Mastermind
There are plenty of applications for the techniques, such as video conferencing, social media and even films. However, the common theme was that, as these technologies become mainstream, we should no longer assume that video evidence of a speaker saying something is actual real.

Leave a comment

Filed under Meetup

IET Meetup: Mountbatten Lecture, 2018

I was lucky to attend the 2018 Mountbatten lecture at Savoy Place, London. This year’s speakers were Dr Julia Sutcliffe of BAE Systems and Air Marshal Julian Young of the Royal Air Force.

Dr Sutcliffe’s theme was “Air Sector Technology – is the sky still the limit?” and spoke of breakthrough technologies such as cloud computing and artificial intelligence as the 4th Industrial Revolution (after Steam, Electricity and Electronics/Computing). Her interest in military air systems is the generation of huge amounts of information for each single flight – not only from machine performance but also from crew health metrics. It would be a game changer to be able to receive the telemetry in real time so that appropriate action could be anticipated and actioned as soon as the plane returns to base. Other topics were unmanned systems for dirty or dangerous tasks and “Chemputation“, a method for using algorithms to build materials.

Air Marshal Young’s theme was “RAF 2118 – Engineering the next 100 years”. His point was that the Royal Air Force has been entwined with technology throughout its whole life, with innovation often the deciding factor in conflicts. Innovation has produced accuracy improvements in weapons delivery as well as amazing reliability for engines (such as the EJ200 in Typhoons). Novel technologies can also deliver increased operational performance, reduce production costs and reduce through-life savings – leaving more money to buy shiny new aeroplanes.

Interestingly, multi-core processors are not currently sanctioned for use in safety-critical systems because predictability is paramount. And whilst 3D printing could potentially allow spares to be produced “in theatre”, in practice it’s more reliable to produce them at home in a factory and send them in one of the daily flights transporting crew/cargo to the area.

The RAF Engineering teams breed a culture of innovation and “restless improvement” with each new generation.

Leave a comment

Filed under Meetup

C++ London Meetup: Tuppence more on Standard Algorithms

This evening of talks was split into a set of Lightning Talks in the first half followed by a discussion about the Standard Library in the second half.

Part 1 – Lightning Talks
Richard Chandler – ACCU 2018 Trip Report – much on C++14 and C++17 standards to catch up on as well as introduction to Kotlin and a number of talks on diversity and inclusivity.

Phil Nash – East End Story
Phil dived into the controversial East Const v West Const debate

    void f( T const& t ) // East const
    void f( const T& )   // West const

i.e. should you put the const before or after the type. This topic was introduced by Dan Saks in 2011 – Simplifying const Syntax, Dr Dobbs and revived by Jon Kalb in A Foolish Inconsistency.

“Const applies to what is on its left, unless there is nothing to the left, in which case it applies to what is on the right.” But using east const format, it always applies to the left! West const reads more naturally from left to right, e.g. “const integer” – the East const argument is that you would always read declarations inside out and right to left!

    char const * const pc = str // pc is a const pointer to a const char, reading right to left

Developers are already accustomed to using East const for const member functions (must put const on the ‘east’ side). And there are other examples of going East:

    // moving the return type further east as a result of c++11
    auto someFunc( int i ) -> std::string; 

    // you have to put the return type on the east side
    auto lambda = [] -> double { return 0; } 

Other considerations: Swift/Haskell have trailing return type; putting auto at the start of list of function definitions, the start of the names line up; C++ standard NL.26 says use conventional const notation, endorses West Const notation, but is itself inconsistent!

Phil is now using trailing return types everywhere in production code – see his blog, East End Functions (LevelOfIndirection.com)

Stewart Becker – A Fool’s Consistency, the rebuttal (Jonathan Muller’s talk)

East const gives more consistency? If 83% of people write const T (i.e. West const), you need to be consistent with everyone else in your codebase.
Const pointer to const fallacy – with modern c++, use const std::string_view instead. Can use std::as_const(x) to get the const cast.
Right-to-left fallacy – but we read loops etc from left to right, and ‘const’ is an adjective which goes before the noun in English.
Clockwise-Spiral rule for function pointers.

const east west const – you are allowed to write const in both the East and West positions!!

Part 2 – Tuppence More on Standard Algorithms – Iakov Sergeev
Iakov believes the standard algorithms should make code easier to implement and read, but are forgotten in practice. He raised issues with inconsistencies and the learning curve to use STL (output iterator, predicates, modifying input sequences, could take both begin/end iterators).

Historically, the predicates were hard to implement where you had to supply a functor to call algorithms. Now, with lambdas, it’s much easier and localised to call algorithms.

The audience felt that Eric Niebler’s work on the Ranges TS should help a lot with adoption of standard algorithms.

Leave a comment

Filed under C++, Meetup, Programming

IET Turing Lecture: Innovation and Technology – Art or Science

This evening at the IET was split into two lectures, the first by Larissa Suzuki entitled “Brave New Smart World”. Larissa covered a lot of ground, scaring the audience with figures on our over-population of the planet, over-consumption and lack of recycling. Then she showed how we may have potential to engineer our way out of these global problems – with smart cities, self-driving cars and smart-recycling.
Quote of the Day:

You cannot jujitsu your way out of bad data


The main Turing Lecture was by Andy Harter, who among other things invented VNC (used for connecting to remote computing devices). The stated intention of the lecture was to make the audience think about whether innovation and technology owe more to Art or Science. The lecturer admitted that his hope was that we’d agree that both are necessary. He covered a number of facets that he believes are the ingredients behind the best inventions: Creativity, Necessity, Storytelling, Timing, Retrospection, Observation, Laziness, Simplicity, Responsiveness and Generosity.

If necessity is the mother of all inventions, laziness is the father!

This quote was quite pertinent to the speaker, who invented VNC so that he didn’t have to leave his office to help a colleague down the corridor with issues on his machine!

Leave a comment

Filed under Meetup

ACCU Meetup: Code Craft

Jason Gorman of CodeManShip gave an interesting talk on code craft this week. The talk began with the business case for Code Craft, based on the cost of changing a line of code. If you compare the number of changes in source code repository to the expense of their development teams, the cost generally increases massively over time – 40X more expensive per line of code change after 8 years for one company. The same hockey-stick chart appears in Kent Beck’s book “Extreme Programming Explained”. Code Craft skills tend to flatten the cost-of-change curve, which is good for the business, and make the code easier to change, which is good for the developers.

Code Craft Skills

Write good unit tests, use version control, do continuous integration, apply design principles, refactor code safely.

Cost – if the cost of a change in design is 1, then the cost in implementation is 6.5, in testing is 15 and in maintenance is 100.  Bringing testing forward in the development process gives a massive return on investment.  Legacy code can be defined as any code that doesn’t have fast running, automated unit tests that can discover a bug quickly – enabling a cheap fix.  You must automate testing and enable the feedback loop to iterate quickly – ideally in minutes or seconds.

Readability – 50%-80% of time spent on a codebase is reading code, not writing it.  Making code easier to read and understand has a great pay-off.  Code that’s hard to understand is easy to break.

Complexity – attack complexity, try to replace it with the simplest thing, which is less likely to be wrong.

Duplication – never copy/paste code, especially off the internet!  You have no idea if it works or even compiles.  Making changes to common logic is multiplied if there’s duplicate code.  Duplication is the opposite of reuse – generate an abstraction to help improve the design.  Duplication can be hard to spot (e.g. customer playing several roles which could have been parameterised).

Ripple Effect – a change to one area of code breaks a much wider circle of code.  Cost of change greatly increased – need to have a local effect from a small change to code.

Principles of Clean Code

The speaker also coaches teams in the following principles:

1. Shorter feedback loops – automated unit testing.  Not possible with manual testing iterations or a manual testing phase.  Automated system testing can give good coverage, but is often too slow, can take hours to run.  Need to run in minutes or seconds.  Ideal chain is Unit Testing -> Integration testing -> System testing.  Want most of the testing in first layer, minimal number of smoke tests in the top System layer.

2. Simple Design – the code works, clearly reveals intent, free of duplication, made out of simple parts.  Need another pair of eyes to check the code is easy to read.  Code review your own code every few minutes.

3. Single responsibility – traditionally, this is taught as classes should only have one reason to change.  Or better, look at the number of combinations of the sections of code implemented in a function – it’s more powerful to break functions into smaller parts then use composition to implement the larger function.  Smaller components/functions => many more ways to re-use. So give each piece of software a single responsibility.

4. Tell, don’t ask – lots of low-level coupling between objects. Better to have objects sharing smallest possible interface to each other. Don’t pass the whole object – pass the data needed to do the operation.  Put the work where the knowledge lives – do the work in the right place so that data and behaviour belong together.

5. Dependency Inversion – you should be able to swap your dependencies.  Talk to dependencies as abstractions through interfaces.  Eg1 all commands inherit from ICommand and high-level components work on generic interface, not concrete classes.  Eg2 VideoRental example, rather than coupling to Imdb, replace with an interface.  Better for mocking/testing as well.

Leave a comment

Filed under Meetup, Programming