Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,610 --> 00:00:04,870
In the last couple of sections, we took this code snippet right here and pulled it apart line by line,
2
00:00:05,050 --> 00:00:09,970
and we've now got a better idea of some of the very basics of the dart language, including variables
3
00:00:10,120 --> 00:00:12,880
a little bit on types and a little bit on functions as well.
4
00:00:13,420 --> 00:00:14,050
In the section.
5
00:00:14,060 --> 00:00:18,790
We're going to start to move forward and start to look at one of the absolute core concepts of the dart
6
00:00:18,790 --> 00:00:22,210
language, which is object oriented programming.
7
00:00:22,780 --> 00:00:30,280
DART uses object oriented programming or OPIS as a paradigm or style for writing code and designing
8
00:00:30,310 --> 00:00:31,150
applications.
9
00:00:31,690 --> 00:00:36,550
With OPIS, we build our applications out of a collection of objects.
10
00:00:37,060 --> 00:00:42,160
An object contains some amount of data relevant to our application, like these pieces of data over
11
00:00:42,160 --> 00:00:46,190
here stored inside of what we call fields or properties.
12
00:00:47,110 --> 00:00:50,220
This data is hidden away from other parts of our application.
13
00:00:50,530 --> 00:00:57,190
The only way to get access to this data right here is through the use of methods which are functions
14
00:00:57,190 --> 00:00:59,200
that are defined directly on this object.
15
00:00:59,950 --> 00:01:04,420
One thing that I want to point out here is that we're using the term object to refer to this thing that
16
00:01:04,420 --> 00:01:06,400
contains some amount of data.
17
00:01:06,910 --> 00:01:10,970
But in DART, you and I are going to work on something just a little bit different.
18
00:01:10,990 --> 00:01:12,770
So kind of a different piece of this puzzle.
19
00:01:13,210 --> 00:01:17,050
So in Dart, you and I are going to create what are called classes.
20
00:01:17,570 --> 00:01:21,480
A class contains a set of rules that define how it works.
21
00:01:22,000 --> 00:01:28,030
You can think of this class right here as being like a blueprint or a ruleset of sorts to actually work
22
00:01:28,030 --> 00:01:28,990
with this class.
23
00:01:29,050 --> 00:01:34,600
We create instances of the class which referred to as either objects or instances.
24
00:01:35,350 --> 00:01:41,530
So a class is just a set of blueprints, whereas an object or an instance represents a real working
25
00:01:41,530 --> 00:01:43,000
copy of that class.
26
00:01:43,750 --> 00:01:46,330
To recap, you and I write code to create classes.
27
00:01:46,480 --> 00:01:49,570
We then use that class to create objects or instances.
28
00:01:50,290 --> 00:01:55,900
A good analogy here between classes and instances is to think of a set of blueprints that might be used
29
00:01:55,900 --> 00:01:56,710
to build a house.
30
00:01:57,310 --> 00:02:02,320
When you first want to get a house built, you would go to an architect and have them put together a
31
00:02:02,320 --> 00:02:06,010
set of blueprints that describe how the house is going to look and function.
32
00:02:06,960 --> 00:02:12,180
After you get that set of blueprints put together, you can then use it to create an unlimited number
33
00:02:12,180 --> 00:02:14,240
of houses or instances.
34
00:02:14,760 --> 00:02:19,830
So in this analogy, as you might guess, the set of blueprints over here is like the class and the
35
00:02:19,830 --> 00:02:24,930
actual built house or the actual standing house that physically exists in front of you would be like
36
00:02:24,930 --> 00:02:26,080
the class or something.
37
00:02:26,100 --> 00:02:27,750
The object or the instance.
38
00:02:29,200 --> 00:02:34,630
Now, in darte, object oriented programming is something that comes up nonstop again and again and
39
00:02:34,630 --> 00:02:38,410
again, so much like types that we were taking a look at earlier, it's something that we're going to
40
00:02:38,410 --> 00:02:41,110
be discussing throughout this course many different times.
41
00:02:41,650 --> 00:02:45,640
If you've ever worked with object oriented programming before, you're going to be in good shape if
42
00:02:45,640 --> 00:02:46,510
you've never touched it.
43
00:02:46,540 --> 00:02:48,620
You're also going to be just fine.
44
00:02:48,940 --> 00:02:53,320
So one of the later projects that we're going to work on inside this course before before we even start
45
00:02:53,320 --> 00:02:58,780
working on Flutter is going to be intended to give you a rock solid footing in object oriented programming.
46
00:02:58,960 --> 00:03:00,950
So you're going to get a lot of experience with it.
47
00:03:01,540 --> 00:03:03,100
Now, let's continue in the next section.
48
00:03:03,160 --> 00:03:08,080
We're going to start talking about how we put together classes in DART and some of the very core foundational
49
00:03:08,080 --> 00:03:09,100
concepts around them.
50
00:03:09,460 --> 00:03:12,030
It's a quick break and we'll write some more code in just a moment.
5079
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.