Uma ferramenta para a detecção de inconformidades com a regra de dependências da Clean Architecture em Python
Arquivos
Data
2022-02-11
Tipo
Trabalho de conclusão de curso
Título da Revista
ISSN da Revista
Título de Volume
Resumo
Devido à necessidade encontrada na Engenharia de Software de criar aplicações com maior coesão e menor acoplamento, Robert C. Martin propôs a Clean Architecture. A Clean Architecture e sua obra literária ensinam diversos conceitos para arquitetos de software e desenvolvedores, conceitos estes que buscam o objetivo único de criar aplicações mais estáveis, duráveis e flexíveis, que conseguem distinguir um detalhe de algo crucial para seu funcionamento. Este trabalho canaliza esforços para modelar e adaptar projetos existentes aos preceitos da Clean Architecture através de detecção de bad smells, termo utilizado para descrever trechos de código que sinalizam problemas, e técnicas de refatoração pertinentes à violação dos preceitos da Clean Architecture. É evidente que muito já foi realizado para catalogar e tratar bad smells clássicos, os code smells. No entanto, o mesmo não pode ser dito para architecture smells, termo também derivado de bad smells, mas com um foco em arquiteturas de software. A fim de encontrar e catalogar maneiras eficazes de realizar refatoração, foram realizadas pesquisas sobre as diferentes formas que os bad smells podem se manifestar, pois, tendo esse conhecimento, se torna factível a detecção destes bad smells e pode ser realizado um experimento em diferentes aplicações a fim de propor novas formas de refatorar o design de uma aplicação. Neste trabalho, os esforços foram direcionados à linguagem Python, e com inspiração em trabalhos realizados para a Clean Architecture e outros estilos arquiteturais como o MVC, em outras linguagens de programação, como Java, PHP e C#, foram agrupadas e comparadas diversas ferramentas de análise estática de código a fim de desenvolver uma maneira de utilizá-las em conjunto para estabelecer regras que identifiquem de forma programática a violação da regra de dependências para a Clean Architecture.
Clean Architecture was first introduced by Robert C. Martin to address the need for more loosely coupled components and better cohesion. The Clean Architecture focuses on preparing software engineers to write more stable, durable and flexible applications capable of distinguishing between mere details (e.g. what framework it uses) and business logic vital to its functioning. This work directs efforts towards redesigning and readapting existing programs to the Clean Architecture through detecting so-called bad smells - a term used to describe when a piece of code might lead to problems in the future - that break Clean Architecture constraints and finding refactoring techniques to solve these smells efficiently. The literature shows that much has been done to catalogue and solve bad smells related to code, often called code smells. However, the same does not apply to architecture smells - its software architecture counterpart. First, research has been done to find different ways architecture smells manifest so that later, it becomes easier to experiment and compare different refactoring techniques that impact existing projects' design. Even though the chosen programming in this work has been Python, thorough research has been done on previous papers showing similar work written in Java, PHP, or C# and other architectural styles such as the MVC. That allows grouping and comparing static code analysis tools and find a way to reuse them to enforce Clean Architecture's Dependency Rule programmatically.
Clean Architecture was first introduced by Robert C. Martin to address the need for more loosely coupled components and better cohesion. The Clean Architecture focuses on preparing software engineers to write more stable, durable and flexible applications capable of distinguishing between mere details (e.g. what framework it uses) and business logic vital to its functioning. This work directs efforts towards redesigning and readapting existing programs to the Clean Architecture through detecting so-called bad smells - a term used to describe when a piece of code might lead to problems in the future - that break Clean Architecture constraints and finding refactoring techniques to solve these smells efficiently. The literature shows that much has been done to catalogue and solve bad smells related to code, often called code smells. However, the same does not apply to architecture smells - its software architecture counterpart. First, research has been done to find different ways architecture smells manifest so that later, it becomes easier to experiment and compare different refactoring techniques that impact existing projects' design. Even though the chosen programming in this work has been Python, thorough research has been done on previous papers showing similar work written in Java, PHP, or C# and other architectural styles such as the MVC. That allows grouping and comparing static code analysis tools and find a way to reuse them to enforce Clean Architecture's Dependency Rule programmatically.