Gustavo Pinto To What Extent Cognitive Driven Development Improves Code Readability? 1 Victor Santiago Alberto de Souza Leonardo Barbosa UFPA & Zup Innovation UFPA Zup Innovation UFPA
@zupinnovation zup.com.br <> @zupinnovation ● Software aging is far from new ● Many old programs are essential and still require maintenance Software gets old
https://github.com/spring-projects/spring-framework/blob/b595dc1dfad9db534ca7b9e8f46bb9926b88ab5a/spring-core/src/main/java/org/springframework/asm/ClassReader.java (~4k LOC) The goal of CDD is to avoid this!
@zupinnovation zup.com.br <> @zupinnovation Cognitive-Driven Development (CDD) ● CDD is a design technique created at Zup Innovation, a Brazilian tech company ● It is based on two psychological theories ○ The Magical Number 7 ○ The Cognitive Load Theory
@zupinnovation zup.com.br <> @zupinnovation The Magical Number 7 (+/- 2) (Miller, 1956) ● We are only able to process 7 (+/- 2) units of information in short-term memory. ● As we receive more information simultaneously, we lose the ability to process it (and we tend to make mistakes). Units of information Comprehension
@zupinnovation zup.com.br <> @zupinnovation Cognitive Load Theory (Sweller, 1988; Sweller, 2010) ● Each material has its own intrinsic complexity, and requires some cognitive effort ○ Sometimes big, sometimes small ● Certain types of items can hinder our understanding
@zupinnovation zup.com.br <> @zupinnovation CDD in a nutshell ● It provides a limit indicating how much a code unit could grow ● It defines the code elements that hinder our understanding (and then should be limited)
@zupinnovation zup.com.br <> @zupinnovation Cognitive-Driven Development (CDD) ● It provides a limit indicating how much a code unit could grow ● It defines the code elements that hinder our understanding (and then should be limited) SBES 2021 ICSME 2020
Encapsulating error handling Original (50%) CDD (50%) “Logging with try-catch is so common that I didn’t even need to read the code to understand its purpose." “the code is smaller and sounds like English"
Encapsulating error handling “It is important to known which exception could be raised” “The method signature is clear and it makes it easier to understand its behavior” Original (14%) CDD (86%)