When using programming languages, type systems are crucial tools in the hands of developers to guarantee an elevated level of safety of their programs. However, type systems are not used to their full extent in practice, and trade-offs are made. This mainly manifests in developers overusing built-in and well-known library types, such as or , instead of types that express the domain of the represented values with a finer granularity. The results of this range from a hindrance to code comprehension to subtle security vulnerabilities going undetected for potentially years. Education is a crucial element in combating the trend of quality deterioration in software projects. By teaching the new generation of developers the importance of stronger and safer types, we hope to ensure more sustainable development processes in the future. In this paper, we detail how the education of strong typing was introduced in our Advanced C++ M.Sc. subject. While certain ideas of strong typing are actionable from the very early subjects in education, the hands-on experience with improving an existing, hard-to-understand code ensures students internalise the ideas better. We discuss the lifting of an example software project to strong types step-by-step.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Using Strong Types in C++ for Long-Term Code Management

  • Richárd Szalay,
  • Zoltán Porkoláb

摘要

When using programming languages, type systems are crucial tools in the hands of developers to guarantee an elevated level of safety of their programs. However, type systems are not used to their full extent in practice, and trade-offs are made. This mainly manifests in developers overusing built-in and well-known library types, such as or , instead of types that express the domain of the represented values with a finer granularity. The results of this range from a hindrance to code comprehension to subtle security vulnerabilities going undetected for potentially years. Education is a crucial element in combating the trend of quality deterioration in software projects. By teaching the new generation of developers the importance of stronger and safer types, we hope to ensure more sustainable development processes in the future. In this paper, we detail how the education of strong typing was introduced in our Advanced C++ M.Sc. subject. While certain ideas of strong typing are actionable from the very early subjects in education, the hands-on experience with improving an existing, hard-to-understand code ensures students internalise the ideas better. We discuss the lifting of an example software project to strong types step-by-step.