Placeholder Image

字幕列表 影片播放

  • Okay, um this, this is going to be a little bit of a tough one. Here we are we're going to...

    好的,嗯,這有點困難。在這裡,我們要去...

  • begin talking about

    開始談論

  • object-oriented programming and the theory of object-oriented programming in a way.

    面向對象程序設計和麵向對象程序設計的理論。

  • And probably gonna remake this video, later but it's just going to live for

    可能會重新製作此視頻,但稍後將繼續播放

  • live with it for right now. So what I want to do in this video we're getting

    現在就住。所以我想在這個視頻中做的是

  • into the nitty-gritty, and the nuts and bolts.

    進入堅韌不拔的地方,以及螺母和螺栓。

  • We're going to look at the implementation what it means to write a class to use objects to make multiple objects. Later

    我們將看一下實現,編寫一個類以使用對象來創建多個對象意味著什麼。後來

  • we will do arrays of objects. There's so much to come forward. But to start with, to begin with

    我們將處理對像數組。有很多事情要做。但首先要開始

  • we need to take a deep breath and just understand what are we trying to do with object-oriented programming?

    我們需要深吸一口氣,只是了解我們將如何處理面向對象的編程?

  • Well okay. So in one sense

    哦,那好吧。所以從某種意義上說

  • we're trying to understand a

    我們試圖了解一個

  • computer program in the way that we think is somewhat about the world. And we've got one right over here.

    我們認為與世界有關的計算機程序。我們這裡有一個。

  • We have this ball bouncing around the screen and we can see I've actually written this program already

    我們的球在屏幕上彈起,我們可以看到我已經寫了這個程序

  • using object-oriented programming. This is where

    使用面向對象的編程。這是哪裡

  • we want to get to. Understanding all of the pieces here by the end of this, of this this set of videos but

    我們想去。到此為止,了解這組視頻的所有內容,但是

  • we can start with this here. What we did... what we're looking at here is we're seeing the manifestation,

    我們可以從這裡開始。我們做了什麼...我們在這裡看到的是我們看到的表現形式,

  • the... an instance of a ball object moving around the screen.

    the ...球對像在屏幕上移動的實例。

  • What is a ball object? What Is the innovation of Object-Oriented Programming?

    什麼是球物體?面向對象編程的創新是什麼?

  • Well, our programs so far, have looked like this. We have setup(),

    好吧,到目前為止,我們的程序看起來像這樣。我們有setup(),

  • we have draw().

    我們有draw()。

  • Right, that is the sort of framework for the flow of our program. What else do we have? We have a bunch of variables.

    是的,那是我們程序流程的一種框架。我們還有什麼?我們有很多變量。

  • Up here, we can think of that as

    在這裡,我們可以認為這是

  • the data

    數據

  • of a program. This is the data of a program. The x, the y, the xSpeed, the ySpeed, the color, the film, blah, blah, blah

    一個程序。這是程序的數據。 x,y,xSpeed,ySpeed,顏色,膠片,等等,等等,等等

  • We have the Functionality. What are the things that are happening? Something's moving, something's checking its edges, it's being displayed, it's...

    我們有功能。發生了什麼事?某物正在移動,某物正在檢查其邊緣,正在顯示,這是...

  • exploding, its be... it's doing stuff. Happy, it's dancing! Right? We should have a dancing ball for a bouncing ball. But next time.

    爆炸了,它正在做某事。快樂,它在跳舞!對?我們應該有一個跳舞球作為彈跳球。但是下一次。

  • We have Functionality.

    我們有功能。

  • Move... I think I actually called it an update. We can see update in this. We have maybe a function called display.

    移動...我想我實際上稱它為更新。我們可以看到更新。我們也許有一個叫做display的功能。

  • You know displayBall. We had it in one of our most recent programs we wrote. We have...

    您知道displayBall。我們在我們編寫的最新程序之一中擁有它。我們有...

  • Functionality

    功能性

  • What Object-Oriented Programming does for us is it says: "Ok, we have data and we have functionality."

    面向對象編程為我們所做的就是說:“好吧,我們有數據,我們有功能。”

  • We want to put those things together.

    我們希望將這些東西放在一起。

  • We want to have an object that wraps the data for an entity, the functionality for an entity,

    我們想要一個對象,該對象可以包裝實體的數據,實體的功能,

  • all together. What is that entity? Well that's what's up to you. Conceptually how

    全部一起。那是什麼實體?好吧,這取決於您。從概念上講

  • you organize the pieces of your program. If we were to make this palm, maybe there would be some paddles. So there would be

    您可以組織程序的各個部分。如果我們要製造這種手掌,也許會有一些槳。所以會有

  • paddle objects and a ball object. Maybe there would be some

    槳對象和球對象。也許會有一些

  • thing we need to sort of manage the whole game. The score, the player names. Maybe we'd have a game manager object that

    我們需要管理整個遊戲的事情。比分,球員姓名。也許我們會有一個遊戲管理員對象

  • has that data associated with it. So we're looking to take data and functionality and put them together.

    有與之相關的數據。因此,我們希望將數據和功能整合在一起。

  • We can think of this... One way to start thinking about this...

    我們可以想到這一點。

  • Is actually to think about you yourself or me myself as an object.

    實際上是以您自己或我自己為對象來思考。

  • We are an object living in our world. What do we have? We have data.

    我們是生活在我們世界中的對象。我們有什麼?我們有數據。

  • For a human object. A human object. A human has data. Maybe a human has a height,

    對於人類物體。一個人的對象。一個人有數據。也許人有身高,

  • an eye color,

    眼睛的顏色

  • a sort of personality.

    一種個性。

  • Right, there's so many things.

    是的,有很多東西。

  • A way to...

    一種方式...

  • Beard length.. and... whatever. As you can see that there's lots of data that can be associated to

    鬍子的長度.....無論如何。如您所見,有很多數據可以關聯到

  • describe those sort of aspects of a human being. A human being can

    描述人類的那些方面。人類可以

  • also do things. There might be Functionality. For example, I can eat, I'm actually right

    也做事。可能有功能。舉例來說,我可以吃,我說的對

  • pretty out of time to get lunch because I have some office hours appointments. I really

    因為我有一些辦公時間的約會,所以沒有時間去吃午飯。我真的

  • should be stopping this video but we've gone for four minutes, we're almost at the end. I can eat. I could sleep.

    應該停止播放此視頻,但是我們已經走了四分鐘,快到尾聲了。我可以吃我可以睡了

  • I could run. Right? There is Data and Functionality

    我可以跑步。對?有數據和功能

  • associated with a human. What would it mean to package all those things up into an object so that we could add

    與人有關。將所有這些東西打包成一個對象,以便我們可以添加,這意味著什麼?

  • human beings to our Processing sketch? Now that might be a little bit ambitious but but...

    人類到我們的加工草圖?現在可能有點野心勃勃,但是...

  • We could get there eventually. So this is the theory behind what we're doing.

    我們最終可以到達那裡。這就是我們正在做的背後的理論。

  • We can start to see the syntax that looks like this. Now how does

    我們可以開始看到如下所示的語法。現在如何

  • Processing know what to do when to make a ball object or what to do when to update a ball object?

    處理知道何時製作球對像或更新球對象時該怎麼做?

  • Well there's actually a sort of secret little tag here which I'll just flip to real quickly.

    好吧,實際上這裡有一個秘密的小標籤,我將很快將其轉換為真實標籤。

  • We'll look at this. This is all the code for the ball object.

    我們來看一下。這就是球對象的所有代碼。

  • This is like a mini program to describe

    這就像一個描述迷你程序

  • everything that's to do with a ball. There's variables from the ball. There's functions for the ball. That's what

    與球有關的一切。球上有很多變數。有球的功能。那就是

  • we're going to get to in future videos. How do we write that.

    我們將在以後的視頻中介紹。我們該怎麼寫。

  • But we should notice something about this that's pretty important.

    但是我們應該注意到一些非常重要的事情。

  • And this is going to be very important to the next set of videos that

    這對於下一組視頻非常重要

  • we're about to look at. The examples we're about to make.

    我們將要看。我們將要製作的示例。

  • There is this idea here.

    這裡有這個想法。

  • What have I written up on the board here. I have not put a human being in board. There is no human being here.

    我在這裡寫了什麼。我還沒有人參與。這裡沒有人。

  • What I have done is given you a template for making a human being. This is the cookie cutter. The cutter to

    我所做的就是為您提供製作人的模板。這是千篇一律。切刀

  • cut a human being out of the

    把人從

  • stuff that would make a human being. Right? But there is something.. this is the

    會造就人類的東西。對?但是有東西..這是

  • concept of what it means to be a human being. Then there is right here. The human being, him, or herself.

    成為人類意味著什麼的概念。然後就在這裡。人,他或她自己。

  • Right? I am an instance of a human being object. I am a human being. I am human.

    對?我是人類對象的一個實例。我是人我是人。

  • Ah don't ah... Whatever. Anyway this is what it means to be a human being.

    啊不是啊...隨便無論如何,這就是成為人類的意義。

  • I know it seems silly that I'm going on and on about this but this is actually quite important. We have this

    我知道我一直在進行這件事似乎很愚蠢,但這實際上很重要。我們有這個

  • thing in Processing we're going to see, which is called a class. A class you can think of as the template.

    我們將看到處理中的東西,稱為類。您可以將其視為模板的類。

  • Right, a cookie cutter is a template for making a cookie.

    正確,小甜餅切割器是製作小甜餅的模板。

  • A cookie which I could eat. Yum, yum, yum. Is the cookie itself. This is quite important.

    我可以吃的餅乾。百勝,百勝。是cookie本身。這很重要。

  • We need to write the class. We need to write the template

    我們需要編寫類。我們需要寫模板

  • for what it is to make a ball so that we can have an actual instance of a ball object in our program. So the

    製作球的目的是什麼,以便我們可以在程序中擁有球對象的實際實例。所以

  • class is the template. The object...

    類是模板。物體...

  • is the thing

    是東西

  • itself.

    本身。

  • So this is where we're going and I think in the next video or if I look at my outline correctly. What

    所以這就是我們要去的地方,我想在下一個視頻中,或者如果我正確地看了我的輪廓。什麼

  • we're going to do is learn how to write a class. We're going to learn how to write a class so that

    我們要做的是學習如何編寫課程。我們將學習如何編寫課程,以便

  • we can make an object in our program. What we're seeing here right now is the object

    我們可以在程序中創建一個對象。我們現在在這裡看到的是對象

  • itself, the instance of a ball. What's on this mysterious

    本身就是一個球的實例。這神秘的事是什麼

  • second tab here is the class. The template. The things don't exist unless

    第二個選項卡是課程。模板。除非不存在

  • we use them. The template is what defines what it Is to be a ball

    我們使用它們。模板定義了什麼是球

  • bouncing around the screen in

    在屏幕上彈跳

  • Processing. So this is what we're looking to do. This is what we're hoping to do in these next set of videos.

    加工中。這就是我們想要做的。這就是我們希望在下一組視頻中做到的。

  • Think about this. I don't really have an exercise for this. Ah! Here's an exercise.

    考慮一下。我真的沒有鍛煉。啊!這是一個練習。

  • Take something you've done in a Processing sketch and

    採取您在“處理”草圖中完成的工作,然後

  • try to write as a list, just write for yourself what is the data associated with it.

    嘗試以列表形式編寫,只為自己編寫與之關聯的數據是什麼。

  • What is... what are the functions associated with it. So design your template without code. You could do this with pencil and paper and if

    什麼是...與之關聯的功能是什麼。因此,無需代碼即可設計模板。你可以用鉛筆和紙做,如果

  • you want you can even sort of

    你想要你甚至可以

  • imagine what it would be to type the program like this. Without knowing what each piece of the syntax does. You can kind of

    想像這樣輸入程序是什麼。不知道每個語法的作用。你可以

  • look at this and understand its structure. Okay so in the next video, we will actually look at writing the class itself.

    看一下並了解其結構。好的,在下一個視頻中,我們將實際研究編寫類本身。

Okay, um this, this is going to be a little bit of a tough one. Here we are we're going to...

好的,嗯,這有點困難。在這裡,我們要去...

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋