EKON20 Conference, November 2016
Starting from Michael C. Feathers “Working Effectively with Legacy Code”, we will introduce the concept of “technical debt”, and some practical patterns to integrate testing, separation of concerns, structure, re-usability, to ease maintenance and evolution of existing projects. Don’t forget that even new projects will soon become legacy… Of course, we will introduce some mORMot features which were developed to reduce your pain in this process.
Server side process does react to business events. User actions, timers, other services may trigger states of change, which should be tracked and propagated. A classical implementation is to define a shared database or centralized message queue, locally or in the cloud. When applied to Microservices, this monolithic approach will quickly appear as a limitation.
In this session, we will introduce how Microservices could have their own dedicated persistence layer (i.e. database), and how real-time callbacks could be used to leverage real-time propagation of events, without any centralized message queue. Both ORM and SOA features of the Open Source mORMot framework will illustrate how to write such stand-alone services.
The most powerful way of writing REST services is to define them via interfaces, then let the SOA/REST framework do all the routing, data marshalling and communication behind the scenes. One distinctive feature of mORMot is to define a method parameter as a notification interface, and let the server call back the client when needed, as with regular Delphi code. This session will present the benefit of defining REST services using interfaces, and how WebSockets can offer real-time notifications into your rich Delphi client applications.
The OpenSource mORMot is a RESTful ORM / MVC / SOA framework for Delphi and FreePascal. Some of its codebase is now about 10 years old, and it was time to clean and evolve. This year 2020 triggered a deep refactoring of the whole source code, with a full rewrite of some core components (JSON, RTTI). This session will present the version 2 of mORMot it its current state, the principles behind this refactoring, and how you may find useful gems for your own Delphi applications.
This EKON 22 conference was not about the code formatting - where we put the “begin” keyword is mostly a matter of taste and convention. But it shows how the object pascal strong typing system, and its language expressiveness may help writing clean(er) code. Abstract SOLID principles could help define the class and services hierarchy. After years of server-side coding, we propose some practical guidelines for cleaner object pascal programming, to reduce technical debt, and allow cross-platform/cross-compiler support.
The OpenSource mORMot framework has a strong set of cryptography features. It offers symmetric cryptography with hashing and encryption, together with asymmetric cryptography via private/public key pairs. Its optimized pascal and assembly engines can be embedded into your executable, but you could also call an external OpenSSL library if needed. This session will present mormot.crypt.* units, and apply them to some use cases, from low-level algorithms to high-level JWT or file encryption and signing.
High Performance Object Pascal Code on Servers (at EKON 22)Arnaud Bouchez
This EKON 22 conference is about high performance on servers, written in the object pascal (Delphi / FPC) language. Profiling should be the first step to avoid premature optimization, which is the root of all evil (Knuth). But when some bottlenecks are identified, we introduce some simple architecture patterns (like caching or microservices), data structures and algorithms to make process actually faster, with minimal refactoring. It was a fun session about how to write faster code, ending up by looking at the Delphi CPU view – even if you don’t know assembly.
Advances in Verification - Workshop at BMS College of EngineeringRamdas Mozhikunnath
Day 1 of workshop at BMS college of Engineering
Covers SystemVerilog language fundamentals - Language constructs, building blocks, Arrays, Process, Classes
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Server side process does react to business events. User actions, timers, other services may trigger states of change, which should be tracked and propagated. A classical implementation is to define a shared database or centralized message queue, locally or in the cloud. When applied to Microservices, this monolithic approach will quickly appear as a limitation.
In this session, we will introduce how Microservices could have their own dedicated persistence layer (i.e. database), and how real-time callbacks could be used to leverage real-time propagation of events, without any centralized message queue. Both ORM and SOA features of the Open Source mORMot framework will illustrate how to write such stand-alone services.
The most powerful way of writing REST services is to define them via interfaces, then let the SOA/REST framework do all the routing, data marshalling and communication behind the scenes. One distinctive feature of mORMot is to define a method parameter as a notification interface, and let the server call back the client when needed, as with regular Delphi code. This session will present the benefit of defining REST services using interfaces, and how WebSockets can offer real-time notifications into your rich Delphi client applications.
The OpenSource mORMot is a RESTful ORM / MVC / SOA framework for Delphi and FreePascal. Some of its codebase is now about 10 years old, and it was time to clean and evolve. This year 2020 triggered a deep refactoring of the whole source code, with a full rewrite of some core components (JSON, RTTI). This session will present the version 2 of mORMot it its current state, the principles behind this refactoring, and how you may find useful gems for your own Delphi applications.
This EKON 22 conference was not about the code formatting - where we put the “begin” keyword is mostly a matter of taste and convention. But it shows how the object pascal strong typing system, and its language expressiveness may help writing clean(er) code. Abstract SOLID principles could help define the class and services hierarchy. After years of server-side coding, we propose some practical guidelines for cleaner object pascal programming, to reduce technical debt, and allow cross-platform/cross-compiler support.
The OpenSource mORMot framework has a strong set of cryptography features. It offers symmetric cryptography with hashing and encryption, together with asymmetric cryptography via private/public key pairs. Its optimized pascal and assembly engines can be embedded into your executable, but you could also call an external OpenSSL library if needed. This session will present mormot.crypt.* units, and apply them to some use cases, from low-level algorithms to high-level JWT or file encryption and signing.
High Performance Object Pascal Code on Servers (at EKON 22)Arnaud Bouchez
This EKON 22 conference is about high performance on servers, written in the object pascal (Delphi / FPC) language. Profiling should be the first step to avoid premature optimization, which is the root of all evil (Knuth). But when some bottlenecks are identified, we introduce some simple architecture patterns (like caching or microservices), data structures and algorithms to make process actually faster, with minimal refactoring. It was a fun session about how to write faster code, ending up by looking at the Delphi CPU view – even if you don’t know assembly.
Advances in Verification - Workshop at BMS College of EngineeringRamdas Mozhikunnath
Day 1 of workshop at BMS college of Engineering
Covers SystemVerilog language fundamentals - Language constructs, building blocks, Arrays, Process, Classes
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteVictor Rentea
Clean Code principles have become a cornerstone of professional developer teams worldwide. But frameworks and languages have evolved, and so have the challenges we’re facing today while crafting modern applications. Single-page apps, extremely DRY code, microservices, excessive functional programming, and reactive flows have all taken their toll on our code quality. Hop aboard this roundtrip of the most damaging Code Smells as of 2023 and fill your toolbox with a load of practical tricks you can immediately apply to your day-to-day work. All in an entertaining show spiced with live-coding moments.
During the continuous mORMot refactoring, some core part of the framework was rewritten. In this session, we propose a journey to a refactoring of a single loop. It will take us from a naïve but working approach, to a 10 times faster Pascal rewrite, and then introduce how SSE2 and AVX2 assembly could boost the process even further – to reach more than 30 times improvement! No previous knowledge of assembly is needed: we will try to introduce how modern CPUs work, and will have some fun with algorithms and SIMD parallelism.
Introduction to SOC Verification Fundamentals and System Verilog language coding. Explains concepts on Functional Verification methodologies used in industry like OVM, UVM
Clean architecture - Protecting the DomainVictor Rentea
The goal of architecture is to simplify the most complex parts of your logic. Any other goal should be secondary to this. The problem is that you can’t always anticipate where the complexity of your application will accumulate, especially when confronted with ever-changing requirements. The only way to keep your code simple is to gradually evolve the architecture without adding useless complexity up front, but always looking out for opportunities to break-down and refactor towards the most simple design that solves the problem. Drawing concepts from the Domain-Driven Development mindset, this talk summarizes the most important lessons learned designing and consulting many real-world projects. Along the way, you’ll hear about Value Objects and Entities, DTOs, Dependency Inversion Principle, Facades, the Onion Architecture and many pragmatic tips and tricks immediately applicable to your day-to-day work.
Slides of the talk held at JEEConf, Kiev and jPrime, Sofia. A personal view on the classic topics from the Uncle Bob's Clean Code bible, with some personal additions and tips&tricks. This topic actually represents the core of the training sessions that I provide as an independent trainer (www.victorrentea.ro)
The tests are trying to tell you something@VoxxedBucharest.pptxVictor Rentea
If tests are hard to write, the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t stand it anymore and they will either stop testing or test more superficially. At the other extreme, others struggle to write contrived, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Kamailio is the leading Open Source SIP Server - a SIP proxy, registrar, location server, presence server, IMS server and much more. Find out more by viewing this quick presentation! (Updated June 2014)
You will learn why naming is really difficult if done right, why coding and style guidelines are crucial, code structuring, exception handling and why other elements of coding often define the tipping point between success and failure of projects. Following the principles of software craftsmanship will allow you to end up with better maintainability and extensibility of your software and the success of the project in the end. All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation.
Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs. Writing clean code can significantly lower these costs. However, writing clean code also makes you more efficient during the initial development time and results in more stable code. You will be presented design patterns and best practices which will make you write better and more easily maintainable code, seeing code in a holistic way. You will learn how to apply them by using an existing implementation as the starting point of the presentation. Finally, patterns & practices benefits are explained.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-06-27 SoCal Code Camp - San Diego, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-18 Desert Code Camp - Chandler, AZ
Unit Testing like a Pro - The Circle of PurityVictor Rentea
Best practices on designing unit tests, designing testable production code, a glimpse of TDD, using mocks and isolating pure functions for easy testing. Talk distilled from http://victorrentea.ro/#unit-testing
Held at VoxxedDays Bucharest in March 2019.
Introduced by Eric Evans in 2004 via his Blue Book, Domain Driven Design (DDD) has received tremendous positive feedbacks from many developers & communities over the years. On the other hand, we have to admit that DDD has since not been widely used in the trenches or within most of our development projects... How can we explain such failure in its diffusion? Is DDD in itself difficult or is it just the way people used to present it which makes it hard to grasp and inaccessible? Through our various (more or less successful ;-) experiences, we will try to highlight what DDD is using a simple and more accessible approach. The opportunity for us is to show you how helpful it can be for your day-to-day projects. Wouldn't be the perfect time for all of us to ease the DDD onboarding for beginners and to reboot DDD for experts?
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotikmikrotik-training
Mikrotik — наверное, единственный из доступных для малого и среднего бизнеса роутеров, в котором можно залезать и фильтровать данные, находящиеся на уровне пользовательских приложений.
Именно поэтому на Mikrotik можно настроить правила фильтрации, которые срабатывают на определенный контент и могут надежно заблокировать такой тип трафика как:
— Skype
— Torrent
— VPN
— ICQ и прочие IM
и многое другое.
Поэтому, если от руководства или службы безопасности вам поступают такие запросы, после вебинара вы будете знать, как это настраивается!
P.S. Вообще, залезать в данные, находящиеся на L7 - это определенная магия.
Но что делать, если данные идут по HTTPS, ведь внутрь туда не залезть, скажете вы и будете правы. Однако, и тут есть решение, о котором мы немного расскажем на вебинаре. А подробно и с демонстрацией - на другом вебинаре, по фильтрации HTTPS-трафика.
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
Kotlin InDepth Tutorial for beginners 2022Simplilearn
This tutorial by Simplilearn is based on Kotlin In-Depth Tutorial for 2022. This video is curated by industry experts based on the current IT standards and organized in the learning order. This Kotlin tutorial will help you with the fundamentals of kotlin programming language and also Android development with kotlin. This kotlin tutorial will guide you with critical skills, tips, and tricks required to be an expert in kotlin programming language.
In this tutorial, on the Kotlin tutorial, we will be learning about the important topics and basics of Kotlin language that one should know to understand Kotlin language. In this Kotlin tutorial for beginners, we will be learning about the Variables in Kotlin, String templates, if-else, and when statements. We will also learn about arrays, loops, ranges, and much more with help of hands-on examples.
Art of refactoring - Code Smells and Microservices AntipatternsEl Mahdi Benzekri
Refactoring is the process of improving the code without creating new functionality or changing an existing functionality.
Writing simple and avoiding complexity is the key to a good software design, changing the code become easier.
Code smells are undesired patterns that negatively affect software.
A survey about bad smells in Microservices architecture is presented with relevant examples and solutions.
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteVictor Rentea
Clean Code principles have become a cornerstone of professional developer teams worldwide. But frameworks and languages have evolved, and so have the challenges we’re facing today while crafting modern applications. Single-page apps, extremely DRY code, microservices, excessive functional programming, and reactive flows have all taken their toll on our code quality. Hop aboard this roundtrip of the most damaging Code Smells as of 2023 and fill your toolbox with a load of practical tricks you can immediately apply to your day-to-day work. All in an entertaining show spiced with live-coding moments.
During the continuous mORMot refactoring, some core part of the framework was rewritten. In this session, we propose a journey to a refactoring of a single loop. It will take us from a naïve but working approach, to a 10 times faster Pascal rewrite, and then introduce how SSE2 and AVX2 assembly could boost the process even further – to reach more than 30 times improvement! No previous knowledge of assembly is needed: we will try to introduce how modern CPUs work, and will have some fun with algorithms and SIMD parallelism.
Introduction to SOC Verification Fundamentals and System Verilog language coding. Explains concepts on Functional Verification methodologies used in industry like OVM, UVM
Clean architecture - Protecting the DomainVictor Rentea
The goal of architecture is to simplify the most complex parts of your logic. Any other goal should be secondary to this. The problem is that you can’t always anticipate where the complexity of your application will accumulate, especially when confronted with ever-changing requirements. The only way to keep your code simple is to gradually evolve the architecture without adding useless complexity up front, but always looking out for opportunities to break-down and refactor towards the most simple design that solves the problem. Drawing concepts from the Domain-Driven Development mindset, this talk summarizes the most important lessons learned designing and consulting many real-world projects. Along the way, you’ll hear about Value Objects and Entities, DTOs, Dependency Inversion Principle, Facades, the Onion Architecture and many pragmatic tips and tricks immediately applicable to your day-to-day work.
Slides of the talk held at JEEConf, Kiev and jPrime, Sofia. A personal view on the classic topics from the Uncle Bob's Clean Code bible, with some personal additions and tips&tricks. This topic actually represents the core of the training sessions that I provide as an independent trainer (www.victorrentea.ro)
The tests are trying to tell you something@VoxxedBucharest.pptxVictor Rentea
If tests are hard to write, the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t stand it anymore and they will either stop testing or test more superficially. At the other extreme, others struggle to write contrived, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Kamailio is the leading Open Source SIP Server - a SIP proxy, registrar, location server, presence server, IMS server and much more. Find out more by viewing this quick presentation! (Updated June 2014)
You will learn why naming is really difficult if done right, why coding and style guidelines are crucial, code structuring, exception handling and why other elements of coding often define the tipping point between success and failure of projects. Following the principles of software craftsmanship will allow you to end up with better maintainability and extensibility of your software and the success of the project in the end. All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation.
Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs. Writing clean code can significantly lower these costs. However, writing clean code also makes you more efficient during the initial development time and results in more stable code. You will be presented design patterns and best practices which will make you write better and more easily maintainable code, seeing code in a holistic way. You will learn how to apply them by using an existing implementation as the starting point of the presentation. Finally, patterns & practices benefits are explained.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-06-27 SoCal Code Camp - San Diego, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-18 Desert Code Camp - Chandler, AZ
Unit Testing like a Pro - The Circle of PurityVictor Rentea
Best practices on designing unit tests, designing testable production code, a glimpse of TDD, using mocks and isolating pure functions for easy testing. Talk distilled from http://victorrentea.ro/#unit-testing
Held at VoxxedDays Bucharest in March 2019.
Introduced by Eric Evans in 2004 via his Blue Book, Domain Driven Design (DDD) has received tremendous positive feedbacks from many developers & communities over the years. On the other hand, we have to admit that DDD has since not been widely used in the trenches or within most of our development projects... How can we explain such failure in its diffusion? Is DDD in itself difficult or is it just the way people used to present it which makes it hard to grasp and inaccessible? Through our various (more or less successful ;-) experiences, we will try to highlight what DDD is using a simple and more accessible approach. The opportunity for us is to show you how helpful it can be for your day-to-day projects. Wouldn't be the perfect time for all of us to ease the DDD onboarding for beginners and to reboot DDD for experts?
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotikmikrotik-training
Mikrotik — наверное, единственный из доступных для малого и среднего бизнеса роутеров, в котором можно залезать и фильтровать данные, находящиеся на уровне пользовательских приложений.
Именно поэтому на Mikrotik можно настроить правила фильтрации, которые срабатывают на определенный контент и могут надежно заблокировать такой тип трафика как:
— Skype
— Torrent
— VPN
— ICQ и прочие IM
и многое другое.
Поэтому, если от руководства или службы безопасности вам поступают такие запросы, после вебинара вы будете знать, как это настраивается!
P.S. Вообще, залезать в данные, находящиеся на L7 - это определенная магия.
Но что делать, если данные идут по HTTPS, ведь внутрь туда не залезть, скажете вы и будете правы. Однако, и тут есть решение, о котором мы немного расскажем на вебинаре. А подробно и с демонстрацией - на другом вебинаре, по фильтрации HTTPS-трафика.
Functional Patterns with Java8 @Bucharest Java User GroupVictor Rentea
The slides for the presentation I gave at Bucharest Java User Group. This session was the largest Romanian Java community meetup ever organized until now.
Kotlin InDepth Tutorial for beginners 2022Simplilearn
This tutorial by Simplilearn is based on Kotlin In-Depth Tutorial for 2022. This video is curated by industry experts based on the current IT standards and organized in the learning order. This Kotlin tutorial will help you with the fundamentals of kotlin programming language and also Android development with kotlin. This kotlin tutorial will guide you with critical skills, tips, and tricks required to be an expert in kotlin programming language.
In this tutorial, on the Kotlin tutorial, we will be learning about the important topics and basics of Kotlin language that one should know to understand Kotlin language. In this Kotlin tutorial for beginners, we will be learning about the Variables in Kotlin, String templates, if-else, and when statements. We will also learn about arrays, loops, ranges, and much more with help of hands-on examples.
Art of refactoring - Code Smells and Microservices AntipatternsEl Mahdi Benzekri
Refactoring is the process of improving the code without creating new functionality or changing an existing functionality.
Writing simple and avoiding complexity is the key to a good software design, changing the code become easier.
Code smells are undesired patterns that negatively affect software.
A survey about bad smells in Microservices architecture is presented with relevant examples and solutions.
Clan code is extremely essential to build scalable application which can be maintained quite easily and improved further
Slide was prepared with contribution to my colleague
and i thank them for the help!
Second "code school lesson" for Eurosport's developers.
1. Refactoring : when? why? how?
2. Single Responsability
3. Practical case : clean architecture.
”In general programmers are pretty smart people. Smart people sometimes like to show off their smarts by demonstrating their mental juggling abilities. One difference between a smart programmer and a professional programmer is that the professional understands that clarity is king. Professionals use their powers for good and write code that others can understand.”
Ursula Sarracini - When Old Meets New: CodebasesAnton Caceres
Presented at FrontConf 2017 in Munich by Ursula Sarracini
When your codebase has 13 million lines of code, is written in C++/XUL, and dates back to 1998, it may seem like an impossible task to write a modern web app using technologies like React, and tools like Github, while still managing a graceful integration with the existing codebase. Developing new functionality in a legacy codebase which wasn’t originally built for the modern web can introduce a bunch of new and exciting challenges. This talk will categorize the problems of when old code meets new code in four ways: testing challenges, source control and issue tracking challenges, human and cultural challenges, and technical challenges.
At Mozilla, I’m working on a major feature which was developed independently from the rest of the Firefox codebase, and has since been tightly integrated into the rest of the source tree. Along the way we have faced challenges in each of the categories. I will identify some of the pitfalls that developers can run into when trying to merge old and new codebases, and will provide practical advice in avoiding these problems down the road.
Basic concept on Systems/Software Analysis, Design & Development, how software engineering, large projects are done, collaborated, best practices & standards.
You’re finally doing TDD, but your past mistakes are catching up with you. No matter what you do, you can’t get rid of the gaping black holes caused by your legacy code.
In this presentation, we learn about the causes of legacy code and the reasons it is so difficult to work with. Then we discuss various techniques to test untestable code, revive and simplify incomprehensible code, redesign stable yet untested code, and repair that rift we created in the time-space continuum.
Presentation for CSS Dev Conf 2014
Have a love/hate relationship with pre-built frameworks? Consider building your own system for front-end development.
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
Legacy Code. I never wrote it; everybody else did!
How many times have you waded through an ageing, decaying, tangled forrest of code and wished it would just die?
How many times have you heard someone say that what really needs to happen is a complete rewrite?
I have heard this many times, and, have uttered that fatal sentence myself.
But shouldn’t we love our legacy code?
Doesn’t it represent our investment and the hard work of ourselves and our predecessors?
Throwing it away is dangerous, because, before we do, we’ll need to work out exactly what it does, and we’ll need to tweeze out that critical business logic nestled in a deeply entangled knot of IF statements. It could take us years to do, and we’ll have to maintain two systems whilst we do it, inevitably adding new features to them both. Yes we get to reimplement using the latest, coolest programming language, instead of an old behemoth, but how long will our new cool language be around, and who will maintain that code, when it itself inevitably turns to legacy?
We can throw our arms in the air, complaining and grumbling about how we didn’t write the code, how we would never have written it the way it is, how those that wrote it were lesser programmers, possibly lesser humans themselves, but the code still remains, staring us in the face and hanging around for longer that we could possibly imagine. We can sort it out, we can improve it, we can make it testable, and we can learn to love our legacy code.
Improving The Quality of Existing SoftwareSteven Smith
Presented at DevReach 2013.
As developers, most of our time is spent working on existing software. Sure, occasionally we get the chance to fire up a new Solution in Visual Studio, and that can be exciting. But after the first day, we find ourselves once more having to deal with the work we did yesterday. And today, we know more than we did yesterday, so there are things we’d do differently, if we had it to do over.
Over time, software rots. If we’re not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car – it’s preventive maintenance. In this session, Steve will look at some common places to look for signs of degradation in existing applications, and steps to take to improve the code. Examples will use C# and primarily ASP.NET.
Similar to Ekon20 mORMot Legacy Code Technical Debt Delphi Conference (20)
As a follow-up of the previous session about TFB, we will discuss what kind of tuning was made to the mORMot library, and its associated TFB sample implementation, to reach the top scores in charts. How can a pure Pascal project reach 7 millions of HTTP requests per seconds? How to scale and measure on high-end hardware? Are ORM frameworks damned to slow down everything? How to circumvent the lack of “async” programming at language level? How realistic is such a benchmark?
The TFB challenge is a performance comparison of many web app platforms, exercising JSON, database, ORM, HTML templates, all over HTTP. It compares the best frameworks written in C++, Rust, Go, JS, Java, C#… and now Pascal – thanks to mORMot. In this session, we will look and compare the source code of some frameworks samples, to distinguish their typical philosophy. We will see how modern Object Pascal is still relevant, and propose some ideas for the future of the language.
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotArnaud Bouchez
To illustrate the “Kingdom Driven Design” session proposal, we will expose and comment upon the software core of a custom social media service. It will create a network of user-generated content, not only connected around people or topics, but unleashing some reference text material: literature, law, science, religion – you name it. We will discuss proper KDD architecture, data structures, and associated microservices, using mORMot’s ORM and SOA as toolbox. The code of this new social media system will be disclosed under a GPL agreement, and running on production for years to come. It should be able to scale from a few users to worldwide adoption.
After years working on Domain-Driven Design projects using Delphi for server-side processes, I eventually followed some kind of cut-back version of the DDD paradigms. Introducing Kingdom Driven Design (aka KDD) – since in biology “Kingdom” is the second highest taxonomic rank, just after “Domain”. We will present some principles to help writing not-database-centric code, without being bloated by all the DDD requirements.
Let your Kingdom come!
SOLID principles should better be applied when designing business objects, as soon as maintainability and modularity are needed. They bring uncoupling, abstraction and clean design to Object Oriented Programming. Microservices could be seen as SOLID principles applied to the Service Oriented Architecture. In respect to a classical monolith server, thanks to uncoupling and better granularity, you may enhance deployment, ease cooperation between dev teams, introduce Domain Driven Design and/or Event Driven Design, scale horizontally and still incorporate existing code and services.
After a quick and practical review of SOLID principles, we will see how they may apply to SOA, and how Microservices could be defined using the Open Source mORMot framework interface-based services, on Windows or Linux.
EKON20 WorkShop, November 2016
The Open Source mORMot framework is a huge set of units, with a lot of features. It allows Delphi and FPC to eb true competitors for business projects. In this workshop, we will present how its ORM leverages SQL and NoSQL databases, and how interface-based services ease SOA development. We will show some several cross-cutting features, like SynTests (and stubs/mocks), SynLog, SynMustache, SynDB, SynMongoDB, SynSM, SynPDF, SynCrypto or SynEcc. High-level presentation of the involved concepts will always be followed by some sample code.
EKON20 Conference, November 2016
Monolithic rich Windows applications are not enough for our customers. We are often requested to provide a web front-end, or a REST server to be consumed by mobile or thin clients. Integrating n-Tier architecture to an existing project is challenging. Some good practices, based on industry standards and proven design patterns (like uncoupling or SOLID) can be mind-breaker for RAD developers. In this session, we will define some architectural aspects of SOA, ORM and MVC/MVVM, and what our Open Source mORMot framework offers to ease this transition.
Some slides, as presented during EKON20 conferences, about the mORMot Open Source project, a Delphi/FPC professional framework featuring highly integrated SOA, MVC, ORM, SOLID over SQL and NoSQL databases.
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotArnaud Bouchez
Slides published for BeDelphi 2014 Event.
Create high performance Client Server ORM SOA REST MVC applications using Open Source Synopse mORMot framework and Delphi. Publish any SQL or NoSQL database content over JSON or XML: SQLite3, PostgreSQL, Oracle, MSSQL, FireBird, MongoDB. Define RESTful services using interfaces. Create MVC web applications, using Mustache templates. Running under Windows or Linux, with VCL/FMX clients on Mac OSX, Android or iOS/iPhone/iPad, or AJAX/PhoneGap.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
Recreation management software streamlines operations by automating key tasks such as scheduling, registration, and payment processing, reducing manual workload and errors. It provides centralized management of facilities, classes, and events, ensuring efficient resource allocation and facility usage. The software offers user-friendly online portals for easy access to bookings and program information, enhancing customer experience. Real-time reporting and data analytics deliver insights into attendance and preferences, aiding in strategic decision-making. Additionally, effective communication tools keep participants and staff informed with timely updates. Overall, recreation management software enhances efficiency, improves service delivery, and boosts customer satisfaction.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
2. Reduce our Technical Debt
• Notions
– Technical Debt
– Working Effectively with Legacy Code
• Dependency breaking
• Separation of concerns
• Seams
• Testing
3. Reduce our Technical Debt
• Technical Debt
• Working Effectively with Legacy Code
– Software Seams
– Dependency breaking techniques
– Testing is Everything
• mORMot to the rescue
4. Technical Debt
• BBM /Quick & dirty way
sets up with a technical debt
– Like a financial debt,
incurs interest payment
• Extra efforts in any future development
• Higher maintenance costs
5. Technical Debt
• BBM /Quick & dirty way
sets up with a technical debt
– Difficult to measure
• As software productivity is hard to estimate
• No immediate impact on client software
• Mythical man month from management side
7. Technical Debt
• Debt does smell
– Long standing bugs
• Support and customers know workarounds
– Underestimated effort evaluation
• Simple tasks take a lot of time or resources
8. Technical Debt
• Debt does smell
– Unexpected regressions
• “Edit and pray” maintenance style
– Only the initial code writers dare touch it
• Difficult to find people willing to join
• Even the initial coders fail on the task
9. Technical Debt
• Hard to manage
– First step is to face and evaluate it
• Like any debt, could be eventually resolved
– Bankrupt is possible
• Need clear, prioritized and pragmatic approach
10. Technical Debt
• Hard to manage
– Could be integrated into backlog
• Handle debt as part of legacy system
– Full rewrite may not be the solution
• Netscape syndrome
• Technology change mirage
11. Working Effectively with Legacy Code
• Hard problem, but not unsolvable
Working Effectively
with Legacy Code
The book
12. Working Effectively with Legacy Code
“Legacy Code
offers far more possibilities
for the application of design skill
than new feature do”
Michael Feathers, p. 249
13. Working Effectively with Legacy Code
– Identify where code changes are needed
– Get legacy code into a test harness
– Write tests to protect against regressions
– Introduce proper OOP and SOLID patterns
– Interface between old and new code
– Progressive introduction of SOA
16. Working Effectively with Legacy Code
• Identify a Software Seam
– In Clothing
• The place where two parts are stitched together
• The piece on each side
only touches the other right at the seam
• You may be able to replace a piece with another
17. Working Effectively with Legacy Code
• Identify a Software Seam
– In Software
• A place where you can alter behavior in your
program without editing in that place
18. Working Effectively with Legacy Code
• Identify a Software Seam
– Identify the place
where there is a well defined interface
– Allow to replace implementation
without the rest of the software being able to tell
– Prepare Dependency Injection
or Dependency Inversion
e.g. about persistence or third-party feature
19. Working Effectively with Legacy Code
• Identify a Software Seam
– Allow to replace implementation
without the rest of the software being able to tell
– Use Dependency Injection
first implementation may be 1:1
but will reduce coupling for future evolution
20. Working Effectively with Legacy Code
• Identify a Software Seam
– In Real Life Legacy Software
• There is no such place
where there is a well defined interface
• “Let there be light”, thanks to iterative refactoring
• Follow dependency breaking techniques
21. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
– Adapt from existing
– Where you need to (instability, new features)
– Create a production implementation
– Create a fake implementation
– Write associated test cases
– Refine your interfaces
– Iterate
22. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
23. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities big picture
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
24. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
25. Working Effectively with Legacy Code
1. Know your subject
– In a perfect DDD-oriented world
• Reading the code as a book introduces you
into the reality the computer program is modeling
• Legacy code tends to obfuscate reality
in implementation details
due to BBM iteration
was code focused, not business focused
26. Working Effectively with Legacy Code
1. Know your subject
– First gather a high vision of the problem
• From non-tech experts
• Straight to the main points
• Asking for a 5 min presentation from tech experts
27. Working Effectively with Legacy Code
1. Know your subject
– Ask support for long-standing bugs
– Ask customers for their wishes
• Customers have workarounds for bugs,
not for unexpected behavior
– Ask managers for upcoming features
– Ask older coders
• For the positive aspects of the legacy software
• For what should have been done in another way
28. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
29. Working Effectively with Legacy Code
2. Identify responsibilities
– Probably no documentation
or deprecated documentation
– No code conventions
• Naming, style, design
• Procedural style:
– Spaghetti methods
– Stored procedures
– RAD
30. Working Effectively with Legacy Code
2. Identify responsibilities
– Start from a fresh eye
• Even if you work on this code since decades
• This is an expert’s work, not for rookies
• What should we have done?
• Don’t waste time
31. Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Legacy implementation is valuable
– You will learn how the reality is modelized
• Code archeologists enjoy ancient times
– Software “exegesis”
over several layers
with long history
and a lot of material
– Nihil novi sub sole
32. Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
33. Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
• Group classes and methods
• Identify relationships
• Link to stored data structures
34. Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
• Group classes and methods
• Identify relationships
• Link to stored data structures
• Note any change that would be needed
• Ignore the bugs
35. Working Effectively with Legacy Code
2. Identify relationships
– Between variables and methods
– Evaluate if existing coupling is worth it
– Guess abusive class re-use in several contexts
– Guess how it may be uncoupled in the future
– Don’t be fooled by implementation details
– Ignore the bugs
36. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
37. Working Effectively with Legacy Code
3. Study data structures
“Bad programmers worry about the code.
Good programmers worry about data structures
and their relationships.” Linus T.
38. Working Effectively with Legacy Code
3. Study data structures
– Legacy database is where logic remains
• Extract business knowledge from Relational Model
• Using tools, or existing (old) architecture diagrams
– Identify SQL patterns in code
• Copy & pasta blocks may be Seams
• Eventually refactored as Persistence Services
39. Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
5. Break out huge functions
6. Encapsulate global references
40. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
41. Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Too much methods are killing the methds
– Confusing to use
– Difficult to expand / adapt
– Breaks Single Responsibility Principle (SOLID)
42. Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Refactor by writing new uncoupled classes
executed within the legacy main class
– Old class remains as a Seam
– Old class signature is the Seam interface
– Real implementation moved in new classes
43. Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Iterative process, using unitary testing
• Favor composition over inheritance (SRP)
• Introduce interface for abstraction
• Add unit tests on uncoupled software units
44. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
45. Working Effectively with Legacy Code
• Iterative Code Refactoring
5. Break out huge functions
• Refactor a big function/method
into a new class / set of classes
• Preserve the function signature
as class constructors, or public properties
• Local variables as private members
46. Working Effectively with Legacy Code
• Iterative Code Refactoring
5. Break out huge functions
• Iterative process, using unitary testing
• First implement as a single class method
• Then cut it in smaller (private) methods
• Then several classes (SOLID)
• Favor composition over inheritance (SRP)
• Re-use classes when possible
47. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
48. Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
Identify global variables in disguise
• Singleton or static variables/functions
• Huge main class (TMainForm TDataModule)
• Everything which prevents reentrance
49. Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
Two steps cleaning process
• Identify “families” of global variables or functions
and group them as classes
• Move from a global instance of the class
into an injection mechanism
50. Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
• Enable proper unit testing
thanks to Dependency Injection
• Allows server-side concurrent execution
and progressive switch to SOA
51. Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
52. Working Effectively with Legacy Code
7. Testing is everything
– This is perhaps the hardest part
• Especially if unitary test is new for your teams
• Induce new test code to write and debug
– But also the most valuable
• Avoid regressions and refactoring fear
• If you can test, your code is likely to be uncoupled
53. Working Effectively with Legacy Code
7. Testing is everything
– Getting legacy code under test
• To avoid regressions
• To ensure as safe as possible refactoring
• Define reference datasets, for automated testing
– Brute replay of whole application (not yet unit testing)
– Using e.g. Virtual Machines snapshots
• Test “Bug to bug” behavior of the modified code
– Once bugs are fixed, update reference datasets
54. Working Effectively with Legacy Code
7. Testing is everything
– Value the existing
• Numerous applications and proven User Interface
• Integrate new technologies and patterns
• Continuous integration during build process
55. Working Effectively with Legacy Code
7. Testing is everything
– TDD over each Software Seam
• Write a failing test case
• Compile
• Make it pass
• Repeat
56. Working Effectively with Legacy Code
7. Testing is everything
– Seams specific tests
• Unit testing of the well bounded new interface
• Regression testing against the existing
• Prepare integration with the future Seams
57. Working Effectively with Legacy Code
7. Testing is everything
– Uncoupled seams as interfaces
• Could be stubbed/mocked
• Could be reused
• Could be hosted on a Server (SOA/SaaS)
60. mORMot ToolBox
• Cross-cutting features
– Unit Test
– Logging
– TDocVariant JSON
– SynDB SynMongoDB
– SynCrypto SynECC
– Services
– IoC, stubs and mocks
61. mORMot ToolBox
• Cross-cutting features
– Unit Test
• Light and cross-platform
• Convention over configuration
• Integrated with logging
• Integrated with interface Stubs and Mocks
• Sample 07
62. mORMot ToolBox
• Cross-cutting features
– Logging
• Low overhead, fast value serialization
• Local or remote
• Set of events, not levels
• Fast viewer tool with method and threads profiling
• Exception catch, stack trace
• Used by the whole framework
• Sample 11
63. mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Stores any transient value as document:
• Object
• Array
• Any nested combination of the two
64. mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Low memory overhead
• Data allocation per blocks of variants
• Copy by reference can be enabled
• Instance lifetime managed by the compiler
65. mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Direct objects or arrays JSON support
Late-binding magic
Perfect dynamic values for seams
66. mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
var V: variant; // stored as any variant
...
TDocVariant.New(V); // or slightly slower V := TDocVariant.New;
V.name := 'John'; // property accessed via late-binding
V.year := 1972;
// now V contains {"name":"john","year":1972}
var V1,V2: variant;
...
V1 := _Obj(['name','John','year',1972]);
V2 := _Obj(['name','John','doc',_Obj(['one',1,'two',2.5])]);
V1 := _Json('{"name":"John","year":1982}');
V2 := _Json('{name:"John",doc:["one",1,"two",2.5]}');
67. mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
writeln('name=',V1.name,' year=',V1.year);
// will write 'name=John year=1972'
writeln('name=',V2.name,' doc.one=',V2.doc.one,' doc.two=',doc.two);
// will write 'name=John doc.one=1 doc.two=2.5
V1.name := 'Mark'; // overwrite a property value
writeln(V1.name); // will write 'Mark'
V1.age := 12; // add a property to the object
writeln(V1.age); // will write '12'
writeln(V1); // implicit conversion to string -> as JSON
// will write '{"name":"Mark","year":1972,"age":12}'
writeln(VariantSaveJSON(V1)); // serialize as JSON text
68. mORMot ToolBox
• Cross-cutting features
• SynDB Direct RDBMS access layer
– Not linked to DB.pas
– Multi providers
– UTF-8 JSON
– Interface based
– Knows SQL dialects (used e.g. by the ORM)
– SynDBExplorer tool
69. mORMot ToolBox
• Cross-cutting features
• SynDB Direct RDBMS access layer
– Less data types
– By-pass TDataSet
– Unicode even before Delphi 2009
– Array binding
– Native JSON support
– Remote access
70. mORMot ToolBox
• Cross-cutting features
• SynMongoDB NoSQL acces
– MongoDB native access
– BSON types - TBSONVariant
– TDocVariant support
– Extended JSON
– MongoDB 3.2 support (SCRAM-SHA1)
71. mORMot ToolBox
• Cross-cutting features
• SynCrypto SynECC
– Introduce safe and fast encryption
• AES, SHA, MD5, PBKDF2, PRNG
• Optimized pascal or asm AES-NI, SSE4
– Certificate-based public key cryptography
• Content signature using ECDSA-secp256r1
• Transmission or file encryption ECDH / ECIES
• JSON-based Public Key Infrastructure (PKI)
72. mORMot ToolBox
• Cross-cutting features
• Services
– Daemonization made easy
– Console, install or service mode
– Remote administration interface
– Windows integration
– Cross-platform
73. mORMot ToolBox
• Cross-cutting features
• Inversion Of Concerns (IoC)
– Leverage interface types for seams
– Runtime class instance resolution
TInjectableObject TInterfaceResolver
– Mocks and stubs
(a killer feature)
74. mORMot ToolBox
• Killer features
– SOA
– ORM / ODM
– Stubs and Mocks
– MVC web portals
– DDD CQRS helpers
– SyNode
76. mORMot ToolBox
• Shared features
– Convention Over Configuration
– Cross-Platform and Cross-Compiler
– Fully integrated and coherent
– Made for scaling and performance
– Modular: pickup what is needed,
integrate with existing
– Open Source with active community
77. mORMot ToolBox
• Don’t be afraid
– Huge feature set
– Exhaustive / endless documentation
– Unusual concepts
• Where to start
– Run the samples
– Use the forum
– Publish your test project on github!
78. mORMot ToolBox
• Resources
– http://synopse.info
– http://synopse.info/forum
– http://blog.synopse.info
– http://github.com/synopse/mORMot
Includes exhaustive documentation,
samples and regression tests.