1 00:00:01,010 --> 00:00:05,000 Now that we've seen some notes on how we handle communication with micro services it's time to actually 2 00:00:05,000 --> 00:00:06,240 start writing some code. 3 00:00:06,250 --> 00:00:09,830 So in this video we're going to take a look at a mockup of the application we're going to build. 4 00:00:09,830 --> 00:00:14,540 To better understand these asynchronous communication patterns if we look at the mockup just a couple 5 00:00:14,540 --> 00:00:15,550 of quick notes. 6 00:00:15,650 --> 00:00:20,700 First off the goal this application is to really just get a taste of micros services architecture. 7 00:00:20,780 --> 00:00:25,220 We're going to work on a much larger more comprehensive project later on INSIDE THE COURSE. 8 00:00:25,250 --> 00:00:29,810 This first project is really just meant to get your feet wet and healthy just kind of expose you to 9 00:00:29,810 --> 00:00:32,330 some of these critical issues. 10 00:00:32,340 --> 00:00:37,070 We're also gonna have a goal inside this project of building as much as possible from scratch. 11 00:00:37,160 --> 00:00:40,280 So we're going to build out every last service by hand. 12 00:00:40,280 --> 00:00:45,890 We're going to build out the event broker by hand going to build out as much as we can by hand just 13 00:00:45,890 --> 00:00:47,920 to get really good idea of what is going on. 14 00:00:48,960 --> 00:00:53,520 Because of that because we're building this stuff from scratch I would not recommend using this project 15 00:00:53,580 --> 00:00:56,810 as a template for future micros services projects. 16 00:00:56,820 --> 00:01:00,590 The reason for that is that usually we're going to use a lot of packages to implement a lot of this 17 00:01:00,590 --> 00:01:02,640 stuff as opposed to doing it by hand. 18 00:01:02,640 --> 00:01:07,800 So on real projects you're going to want to use some packages as opposed to these kind of manual implementations 19 00:01:07,800 --> 00:01:09,070 that we're going to do. 20 00:01:09,090 --> 00:01:13,320 Again we're going to work on a very large project later on that's going to be a very serious professional 21 00:01:13,320 --> 00:01:14,020 grade project. 22 00:01:14,250 --> 00:01:17,910 So you are going to see how to use those other packages and whatnot. 23 00:01:17,960 --> 00:01:19,120 Ok so enough of that. 24 00:01:19,200 --> 00:01:20,260 What are we going to build. 25 00:01:20,370 --> 00:01:25,320 You're gonna make a very simple little application that's all about making posts like blog posts or 26 00:01:25,320 --> 00:01:28,110 something similar and allowing users to comment on them. 27 00:01:28,200 --> 00:01:32,460 So any user first comes to application we're gonna show a form like this where user can create some 28 00:01:32,460 --> 00:01:36,570 kind of post we're going to say that our posts only have titles there's not going to be any kind of 29 00:01:36,570 --> 00:01:38,060 body or anything like that. 30 00:01:38,340 --> 00:01:45,300 So a user might type inside of your my post and then hit submit once they do so we're then going to 31 00:01:45,570 --> 00:01:49,530 display the post they just created down here at the bottom the screen. 32 00:01:49,530 --> 00:01:54,470 That would be the post that was just created we'll show that title The Post will show the number of 33 00:01:54,470 --> 00:01:59,480 comments so as associate with it and we'll also have a little form right here to add some comments to 34 00:01:59,480 --> 00:02:01,250 that individual post. 35 00:02:01,250 --> 00:02:09,150 So for example I might type inside of here I'm a comment and then click on cement and if I did so I 36 00:02:09,150 --> 00:02:15,330 should see this post counter right here or the comment counter incremented by 1 and I should also see 37 00:02:15,330 --> 00:02:21,190 the comment listed out right underneath the actual title and then of course we can add in as many posts 38 00:02:21,220 --> 00:02:26,400 as you want so we could go back up here to the top put in post number two. 39 00:02:26,410 --> 00:02:29,140 Hit submit and then we should see post number two. 40 00:02:29,140 --> 00:02:30,120 Down here up here. 41 00:02:30,220 --> 00:02:34,440 And of course we show bill to add in comments like I'm a comment to that one as well. 42 00:02:34,490 --> 00:02:37,540 Hit submit and see that comment up here right there. 43 00:02:37,540 --> 00:02:42,340 So in total this application is pretty straightforward but I think that you're going to be kind of surprised 44 00:02:42,340 --> 00:02:44,960 at the level of complexity that we're going to encounter. 45 00:02:45,070 --> 00:02:49,570 Even for this very simple and straightforward application. 46 00:02:49,590 --> 00:02:49,980 All right. 47 00:02:50,010 --> 00:02:51,920 Now we've got an idea of what we're going to build. 48 00:02:51,930 --> 00:02:56,620 Let's start to break this thing down and consider some of the different technical aspects of it. 49 00:02:56,670 --> 00:03:01,410 So the first thing that we need to think about is what services we are going to create for this part 50 00:03:01,410 --> 00:03:02,160 of the course. 51 00:03:02,250 --> 00:03:07,020 And for a little bit going on into the future right now we're going to say that for every different 52 00:03:07,020 --> 00:03:12,240 unique resource that we have inside of application we're going to create a separate service. 53 00:03:12,240 --> 00:03:16,710 So in our application I would say that we have two different types of resources. 54 00:03:16,710 --> 00:03:21,960 We have posts which are these things we're creating down here at the big blue boxes and then we have 55 00:03:21,960 --> 00:03:27,590 comments which are the things right here the bullet points that are tied to individual posts. 56 00:03:27,630 --> 00:03:30,390 So in total we really have two different resources. 57 00:03:30,390 --> 00:03:34,120 So we're going to think about creating two different services. 58 00:03:34,170 --> 00:03:39,270 We're going to have a postal service that is in charge of storing all the different posts we have and 59 00:03:39,270 --> 00:03:41,240 retrieving them giving them back to us. 60 00:03:41,400 --> 00:03:46,320 And we'll have a common service that is going to be in charge of handling comment creation and listing 61 00:03:46,350 --> 00:03:51,500 all the different comments out so we start to think about these different services. 62 00:03:51,500 --> 00:03:56,270 The first thing we want to really do is really picture the different goals or responsibility of each 63 00:03:56,270 --> 00:03:57,250 service. 64 00:03:57,250 --> 00:04:02,360 So like I just said with a post service we probably want the ability to create a post and to a list 65 00:04:02,360 --> 00:04:08,730 all posts and for comments we probably want the ability to create a comment and list all comments. 66 00:04:08,750 --> 00:04:11,370 Now there's already some hidden complexity inside of here. 67 00:04:11,390 --> 00:04:15,770 The Postal Service is going to be pretty straightforward but if you really start to think about this 68 00:04:15,770 --> 00:04:20,300 and really drill down the common service is going to probably be a little bit more challenging than 69 00:04:20,300 --> 00:04:22,520 you might think at first glance. 70 00:04:22,550 --> 00:04:26,750 The reason for that is that the comment service whenever we create a comment we're going to really be 71 00:04:26,810 --> 00:04:29,450 tying a comment to a post. 72 00:04:29,450 --> 00:04:36,230 So there's going to kind of be a dependency of sorts between reading a comment and having some knowledge 73 00:04:36,290 --> 00:04:38,000 of what posts exist. 74 00:04:38,000 --> 00:04:42,530 So we're going to have to apply one of those asynchronous or synchronous communication patterns we just 75 00:04:42,530 --> 00:04:48,110 discussed to make sure that users can only create comments that are tied to a very specific post. 76 00:04:48,230 --> 00:04:53,180 In addition whenever we tried to list out some comments we probably don't want to just get all the comments 77 00:04:53,180 --> 00:04:54,580 that exist in the universe. 78 00:04:54,650 --> 00:05:00,050 Instead we probably want to somehow retrieve just comments that are associated with some very particular 79 00:05:00,050 --> 00:05:01,020 post. 80 00:05:01,040 --> 00:05:06,200 So in other words if we retrieve the top 10 most popular posts inside our application for example we 81 00:05:06,200 --> 00:05:10,910 probably only want to get comments tied to those specific top 10 posts. 82 00:05:10,940 --> 00:05:14,570 So even though I say right here list all comments well once again there's probably gonna be some kind 83 00:05:14,570 --> 00:05:20,480 of dependency inside of here where the comments that we're retrieving need to somehow be tied to the 84 00:05:20,480 --> 00:05:24,560 actual posts that we're retrieving as well if not that makes sense right now. 85 00:05:24,590 --> 00:05:25,400 That's totally fine. 86 00:05:25,400 --> 00:05:30,560 All I mean to say is that this application is going to be a little bit deceptively challenging even 87 00:05:30,560 --> 00:05:35,290 though it looks like it's really simple and straightforward in nature OK. 88 00:05:35,320 --> 00:05:37,350 So now we've got an idea of what we're going to build. 89 00:05:37,380 --> 00:05:41,550 And it's clear that we're going to run into some challenges along the way quick pause right here and 90 00:05:41,550 --> 00:05:43,410 we'll start to write some code in the next video.