izpis_h1_title_alt

Generics in Java and parallels with templates in C++
ID BOJCHEVSKI, KONSTANTIN (Author), ID Fürst, Luka (Mentor) More about this mentor... This link opens in a new window

.pdfPDF - Presentation file, Download (337,66 KB)
MD5: 95BFAA7A467B86785FFA6C37B0C47570

Abstract
Generics are a powerful tool in object-oriented programming languages, especially in the Java programming language. They play an important role in software development, since they enable the programmer to write typeindependent code in a type-safe way. In a nutshell, a generic Java class (or method) is a class (or method) parameterized with an arbitrary number of types. When using a generic class or method, we specify concrete values for the type parameters, effectively tailoring the code of the class or method for concrete types. Another benefit of Java generics is that type safety is enforced during compilation rather than execution. The C++ programming language has a concept parallel to Java generics; these are templates. C++ templates and Java generics are similar to one another in terms of code syntax, the provided support for parameterizing types, and the most frequent use cases. However, they are actually implemented in a significantly different way, and there are important differences in their use and background semantics. In this thesis, we will show examples for both Java generics and C++ templates. We will discuss their similarities and differences, as well as advantages and disadvantages.

Language:English
Keywords:Java, generics, templates
Work type:Bachelor thesis/paper
Typology:2.11 - Undergraduate Thesis
Organization:FRI - Faculty of Computer and Information Science
Year:2023
PID:20.500.12556/RUL-144199 This link opens in a new window
COBISS.SI-ID:143000579 This link opens in a new window
Publication date in RUL:03.02.2023
Views:742
Downloads:116
Metadata:XML DC-XML DC-RDF
:
Copy citation
Share:Bookmark and Share

Secondary language

Language:Slovenian
Title:Generiki v jeziku java in vzporednice s predlogami v jeziku C++
Abstract:
Generiki so močno orodje v objektno usmerjenih programskih jezikih, še zlasti v jeziku java. Pri razvoju programske opreme igrajo pomembno vlogo, saj omogočajo programerju, da piše kodo, ki je neodvisna od konkretnih tipov, a kljub temu jamči pravilno rabo tipov. Generični javanski razred (oz. metoda) je v osnovi razred (oz. metoda), ki je parametriziran(a) s poljubnim številom tipov. Pri uporabi generičnega razreda oz. metode podamo konkretne vrednosti za tipne parametre in tako prilagodimo kodo razreda oz. metode za konkretne tipe. Druga prednost javanskih generikov je, da se skladnost tipov preverja že v času prevajanja, ne šele v času izvajanja. Koncept, podoben generikom v javi, obstaja tudi v jeziku C++: to so t.i. predloge. Predloge v C++ in generiki v javi so si med seboj podobni po sintaksi, po podpori parametrizaciji tipov in po najpogostejših primerih uporabe, močno pa se razlikujejo po implementaciji. Bistvene razlike lahko najdemo tudi pri uporabi in semantiki generikov in predlog. V tej diplomski nalogi se bomo ukvarjali tako z generiki v javi kot s predlogami v C++. Govorili bomo o njihovih medsebojnih podobnostih in razlikah, pa tudi o prednostih in slabostih.

Keywords:Java, generiki, predloge

Similar documents

Similar works from RUL:
Similar works from other Slovenian collections:

Back