官术网_书友最值得收藏!

Kotlin – Data Types, Objects, and Classes

In this chapter, we'll cover Kotlin's type system, object-oriented programming (OOP) with Kotlin, modifiers, destructuring declarations, and more.

Kotlin is, primarily, an OOP language with some functional features. When we use OOP languages to resolve problems, we try to model the objects that are a part of our problem in an abstract way with the information that is relevant to the problem.

If we're designing an HR module for our company, we'll model employees with state or data (name, date of birth, social security number, and others) and behavior (pay salary, transfer to another division, and others). Because a person can be very complex, there is information that isn't relevant for our problem or domain. For example, the employee's favorite style of bicycle isn't relevant for our HR system, but it is very relevant for an online cycling shop.

Once we identify the objects (with data and behavior) and the relationship with other objects of our domain, we can start developing and writing the code that we'll make a part of our software solution. We'll use language constructs (construct is a fancy way to say allowed syntax) to write the objects, categories, relationships, and so on.

Kotlin has many constructs that we can use to write our programs and, in this chapter, we'll cover many of those constructs, such as:

  • Classes
  • Inheritance
  • Abstract classes
  • Interfaces
  • Objects
  • Generics
  • Type alias
  • Null types
  • Kotlin's type system
  • Other types
主站蜘蛛池模板: 宣威市| 吉林市| 博爱县| 保山市| 三亚市| 自治县| 旌德县| 固原市| 池州市| 基隆市| 永昌县| 西华县| 娄烦县| 南召县| 龙江县| 和田县| 舒兰市| 阜南县| 鄂托克前旗| 岳普湖县| 巴楚县| 镇宁| 长葛市| 得荣县| 财经| 鄂温| 文水县| 南昌市| 华安县| 江都市| 宜丰县| 博爱县| 嵊州市| 哈密市| 台东县| 若羌县| 会理县| 防城港市| 桐梓县| 蓬莱市| 盘锦市|