All language subtitles for 3. Code Demo - Rough Prototype Part 2

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese Download
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 1 00:00:00,975 --> 00:00:02,451 All right, so we have our app working 2 2 00:00:02,451 --> 00:00:03,618 with the BaseballCoach. 3 3 00:00:03,618 --> 00:00:05,475 Now, let's go ahead and add that new requirement 4 4 00:00:05,475 --> 00:00:07,902 of working with a different type of coach. 5 5 00:00:07,902 --> 00:00:10,950 So in my MainApp.java program, 6 6 00:00:10,950 --> 00:00:12,583 I'm gonna change it on the right-hand side, 7 7 00:00:12,583 --> 00:00:15,108 so instead of new BaseballCoach, 8 8 00:00:15,108 --> 00:00:17,525 I'm gonna say new TrackCoach. 9 9 00:00:21,692 --> 00:00:23,066 So, TrackCoach. 10 10 00:00:23,066 --> 00:00:26,166 But now, we don't have a TrackCoach class yet, 11 11 00:00:26,166 --> 00:00:29,282 that's why we have the little red, squiggly underneath that. 12 12 00:00:29,282 --> 00:00:31,166 And also, if we move over to the left-hand side 13 13 00:00:31,166 --> 00:00:33,499 and we click on this little red x, 14 14 00:00:33,499 --> 00:00:35,124 then Eclipse will give us some suggestions 15 15 00:00:35,124 --> 00:00:36,957 and, hmm, interesting. 16 16 00:00:38,473 --> 00:00:42,333 It can actually create the class TrackCoach for me. 17 17 00:00:42,333 --> 00:00:43,500 Mm, I like it. 18 18 00:00:44,379 --> 00:00:45,982 That's pretty cool. 19 19 00:00:45,982 --> 00:00:47,728 Let's try it, so let's go and select this option, 20 20 00:00:47,728 --> 00:00:49,841 Create class TrackCoach, 21 21 00:00:49,841 --> 00:00:52,017 and then, wow, this is great. 22 22 00:00:52,017 --> 00:00:54,090 So it has a name of TrackCoach 23 23 00:00:54,090 --> 00:00:57,107 and also, hmm, they're even gonna implement 24 24 00:00:57,107 --> 00:00:58,743 the interface for us, Coach, 25 25 00:00:58,743 --> 00:01:00,425 that we have from the previous slide. 26 26 00:01:00,425 --> 00:01:05,099 So this is looking pretty good here. (laughs) 27 27 00:01:05,099 --> 00:01:06,933 So let's go ahead and click Finish, 28 28 00:01:06,933 --> 00:01:09,275 and let's see what it does and 29 29 00:01:09,275 --> 00:01:10,108 boo-yah, 30 30 00:01:11,591 --> 00:01:13,745 Eclipse wrote some code for us. 31 31 00:01:13,745 --> 00:01:14,650 This is awesome. 32 32 00:01:14,650 --> 00:01:16,755 So they have the class TrackCoach, 33 33 00:01:16,755 --> 00:01:18,158 implements Coach, 34 34 00:01:18,158 --> 00:01:20,715 and they did the override for that one method, 35 35 00:01:20,715 --> 00:01:22,797 getDailyWorkout. 36 36 00:01:22,797 --> 00:01:25,973 Man, you gotta love that (laughs). 37 37 00:01:25,973 --> 00:01:27,306 Thanks, Eclipse. 38 38 00:01:29,075 --> 00:01:29,908 All right, so let's go ahead 39 39 00:01:29,908 --> 00:01:32,524 and get rid of that auto-generated stub 40 40 00:01:32,524 --> 00:01:35,366 and let's get rid of the null 41 41 00:01:35,366 --> 00:01:38,763 and let's return our workout as a TrackCoach. 42 42 00:01:38,763 --> 00:01:41,763 So we're gonna say, "Run a hard 5k." 43 43 00:01:42,949 --> 00:01:44,082 All right, so our track coach, 44 44 00:01:44,082 --> 00:01:45,865 they're gonna run us really hard, 45 45 00:01:45,865 --> 00:01:49,175 get us into shape for the next track meet. 46 46 00:01:49,175 --> 00:01:50,008 So there we go. 47 47 00:01:50,008 --> 00:01:52,025 So we have the implementation for this setup, 48 48 00:01:52,025 --> 00:01:55,541 so this is our new coach that we just created, TrackCoach, 49 49 00:01:55,541 --> 00:01:56,374 implements Coach, 50 50 00:01:56,374 --> 00:01:58,174 and we gave our custom implementation here 51 51 00:01:58,174 --> 00:01:59,841 for getDailyWorkout. 52 52 00:02:05,425 --> 00:02:08,522 So now, let me move back over to MyApp.java 53 53 00:02:08,522 --> 00:02:09,991 and now this works out just fine. 54 54 00:02:09,991 --> 00:02:11,457 We're in good shape. 55 55 00:02:11,457 --> 00:02:14,277 So we have a new TrackCoach, that class has been created. 56 56 00:02:14,277 --> 00:02:16,708 On the left-hand side, the assignments of theCoach interface 57 57 00:02:16,708 --> 00:02:20,550 because that TrackCoach implements theCoach interface, 58 58 00:02:20,550 --> 00:02:21,607 and will print it out. 59 59 00:02:21,607 --> 00:02:22,483 So let's go ahead and run it. 60 60 00:02:22,483 --> 00:02:25,815 So I'll just do a right-click, Run As, Java Application, 61 61 00:02:25,815 --> 00:02:28,608 and then woo-hoo, "Run a hard 5k," 62 62 00:02:28,608 --> 00:02:32,033 so that's our TrackCoach giving us our daily workout. 63 63 00:02:32,033 --> 00:02:33,407 This is pretty cool, I like it. 64 64 00:02:33,407 --> 00:02:34,499 And then the nice thing about it 65 65 00:02:34,499 --> 00:02:39,266 is that on line 11, we can handle any type of coach 66 66 00:02:39,266 --> 00:02:42,699 because we, again, were coding to the interface, 67 67 00:02:42,699 --> 00:02:44,616 not the implementation. 68 68 00:02:51,624 --> 00:02:53,739 So, we're almost there 69 69 00:02:53,739 --> 00:02:55,366 but again, this is a rough prototype. 70 70 00:02:55,366 --> 00:02:56,917 It's not 100% yet. 71 71 00:02:56,917 --> 00:02:59,025 And the reason it's not 100% 72 72 00:02:59,025 --> 00:03:02,949 is that one of those requirements that we had, 73 73 00:03:02,949 --> 00:03:05,175 one was that this should work with any type of coach 74 74 00:03:05,175 --> 00:03:07,117 and we kind of handled that part of it 75 75 00:03:07,117 --> 00:03:08,100 but the other requirement 76 76 00:03:08,100 --> 00:03:10,800 was that the actual coach implementation 77 77 00:03:10,800 --> 00:03:12,622 should be configurable 78 78 00:03:12,622 --> 00:03:15,916 and that right now, it's not really configurable 79 79 00:03:15,916 --> 00:03:19,216 because it's hardcoded right here. 80 80 00:03:19,216 --> 00:03:20,356 Ideally, it will be great 81 81 00:03:20,356 --> 00:03:24,900 if we could maybe read the actual implementation name 82 82 00:03:24,900 --> 00:03:27,913 from a config file, and then make use of it, 83 83 00:03:27,913 --> 00:03:29,899 so then we could easily swap 84 84 00:03:29,899 --> 00:03:32,356 by only changing a config file 85 85 00:03:32,356 --> 00:03:35,257 instead of having to change the source code. 86 86 00:03:35,257 --> 00:03:39,159 So in the next video, we'll look at Spring 87 87 00:03:39,159 --> 00:03:43,326 and Spring was designed to address this exact problem. 7144

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.