VNUHCM
Bài trước Bài kế tiếp
  • Nội dung học
  • Trợ giúp
    Bạn có thắc mắc khi đang học?
    Hướng dẫn cách học Những câu hỏi thường gặp Email cho giáo vụ
    • Tiếng Việt
    • English
    • Thông tin Thành viên
    • Khoá học đăng ký
    • Đăng xuất
  • Cohota
  • HƯỚNG DẪN HỌC TẬP

  • Xem chi tiết >>
    Bạn đã hoàn thành 0% khoá học
  • HƯỚNG DẪN SINH VIÊN ĐĂNG NHẬP HỆ THỐNG
    • Hướng dẫn đăng nhập
    • Hướng dẫn vào khóa học
  • Introduction
    • Welcome
  • Unit 1: Values
    • Introduction - Unit 1: Values
    • Get Started With Values
    • Play with Values
    • Playground Basics
    • Naming and Identifiers
    • Simulation
    • Strings
    • Constants and Variables
    • Word Games
    • Build a PhotoFrame App
    • Design for People
  • Episode 1: The TV Club
    • Introduction - Episode 1: The TV Club
    • Searching for Content
    • Sharing Personal Information
    • Ordering Online
    • Reflection: Episode 1
  • Unit 2: Algorithms
    • Introduction - Unit 2: Algorithms
    • Get Started with Algorithms
    • Play with Programs
    • Functions
    • Types
    • Parameters and Results
    • Making Decisions
    • BoogieBot
    • Data Visualization
    • Build a QuestionBot App
    • Design an Experience
  • Episode 2: The Viewing Party
    • Introduction - Episode 2: The Viewing Party
    • Accessing the Show
    • Streaming on the Network
    • Reflection: Episode 2
  • Unit 3: Organizing Data
    • Introduction - Unit 3: Organizing Data
    • Get Started with Organizing Data
    • Play with Complex Data
    • Instances, Methods, and Properties
    • Arrays and Loops
    • Structures
    • Enums and Switch
    • Testing Code
    • Processing Data
    • Pixel Art
    • Password Security
    • Visualization Revisited
    • Build a BouncyBall App
    • Design a Prototype
  • Episode 3: Sharing Photos
    • Introduction - Episode 3: Sharing Photos
    • Capturing Images
    • Posting on Social Media
    • Reflection: Episode 3
  • Unit 4: Building Apps
    • Introduction - Unit 4: Building Apps
    • Get Started with App Development
    • Play with App Components
    • Color Picker
    • ChatBot
    • Rock, Paper, Scissors
    • MemeMaker
    • Build an ElementQuiz App
    • Design for Impact
  • Appendix
    • Episode Technical Concepts
    • Glossary
Tổng quan điểm khóa học
Đánh giá

Tiến độ
Tên tiêu chí Trọng số (%) Điểm Tiến độ (%)
Unit 3: Organizing Data

Structures

Unit 3: Organizing Data|Play

What you'll build

  • A data type that models information that's important to you

What you'll learn

  • How to design your own types so you can solve problems with custom-built tools
  • How to give your types extra power by giving them their own methods

Key vocabulary

  • Method
  • Property
  • Struct

Introduction

You've worked with types like String, Int, Double, and Array, but sometimes those types aren't quite right for the problem you're trying to solve. What if you wanted to make a collection of photographs that also tracked their captions? Or a collection list for a garage sale that included both your items' descriptions and their prices?

By designing your own custom structures and tailoring them perfectly to the data you need, you'll have just the right building blocks to help you solve more complex problems.

Go Build

Open the Structures.playground file in your course resources and follow the instructions.

Screenshot of the Structures playground

Reflection Questions

Think of a piece of furniture in your home, and list its properties.

Which properties are mutable and might change over time?

Which properties do you hope will stay the same while you're using it?

Summary

Many problems can be described using primitive types, like String, Int, and Bool. Combining those types together gives you higher-level building blocks to solve your problem. Instead of trying to think about an item that's made up of an anonymous String, another String, a Bool, and a Date, you can instead call that grouping a Message that has a senderName, messageText, isRead, and timestamp.

Again, in yet another form, names are a powerful force in programming. You've named constants, variables, functions, and now entire types. In the next lesson, you'll learn about another way to handle small groups of related values.

Remember

Combining types together gives you higher-level building blocks to solve your problem.

Báo lỗi