The Internet of Things (IoT) is changing the way people live and work by offering numerous benefits, such as the ability to analyse accurate real-time data that helps individuals make decisions. Businesses can automate their processes and provide new and improved services with lower costs through IoT. However, to ensure the performance and functioning of IoT systems, their quality must be closely monitored. A well-designed architecture will produce quality code. Quality code and appropriate architecture will facilitate system maintenance and upgrades, contributing to its overall quality.
We studied methodically a corpus of primary studies, categorising prevalent architectural styles in IoT systems and how they satisfy IoT quality requirements. Service Oriented Architecture (SOA) offers modularity but falls short in accommodating IoT system dynamics, while Microservices Architecture provides flexibility but introduces challenges in performance and communication protocols. Cloud Based Architecture excels in handling complex tasks but demands reliable internet access.
We also compared IoT code with non-IoT code, leveraging metrics such as CBO, CC, MI, RFC, and WMC. We identified best practices based on the results of the comparison, to guide the development of IoT systems. We observed significant differences in code metrics between IoT and non-IoT systems, emphasising higher complexity, low maintainability, and larger code size in IoT software. Best practices include size optimization (loop unrolling, function inlining). Complexity and modularity call for applying refactoring and modularity to simplify software structures, as well as breaking down IoT software into components. Coupling and cohesion recommend the application of design principles and patterns. Code readability and maintainability suggest using textual features and maintaining source code conventions, Model-Driven Architecture (MDA), design patterns, and continuous integration for improved maintainability.