Top 19 # Cách Vẽ Tree Diagram Syntax / 2023 Xem Nhiều Nhất, Mới Nhất 11/2022 # Top Trend |

Drawing Sentence Syntax Trees – Amy Reynolds / 2023

Now that you’ve learned about X-bar structure and determining constituency, you should be able to draw syntax trees. However, there are all sorts of different types of phrases and ways that they can connect, and you have a sentence you need to draw a tree for. What to do!? This page is designed to help guide you through drawing syntactic trees.

We will walk through how to make trees for the following sentences:

Amy bakes pies. 

Amy bakes pies in the summer.

Amy bakes pies for her friends.

Amy thinks that she will bake pies.

Step 1: The IP and CP phrases

As noted above, we automatically expect the head of the Inflection Phrase (IP) to contain the overall tense of the clause, denoted here by the (+/-) PAST feature. Other words that can appear in the head position of the IP include modal (e.g. could, should, would, might, etc.) auxiliaries. However, regardless of whether there is an actual word within the sentence, you should always show the complete IP structure, especially including I.

Step 2: Adding the Subject and Predicate

Step 3: Add other specifiers, complements and modifiers to the phrases

Now that we have the subject and predicate inserted into the structure, it is important to next consider what happens to the rest of the words and phrases left in the sentence. For instance, for the sentence Amy bakes pies, we have Amy and bakes covered, but how does pies attach to the sentence?

We would say that in the summer is a modifier of the VP. Why? Here, it is not adding additional information about the pies, instead, it is telling us when the baking is taking place. We specifically know that it must be a modifier rather than a complement, because the verb does not require that additional information about the baking — not like it requires the direct object pies. Since in the summer is a modifier of the VP, we add another higher up V’ node, so that it can be a sister to the lower V’. Hence, we get the following structure:

Now if we changed the sentence to Amy bakes pies for her friends, should the PP for her friends be in the same location? There are two possibilities here: either Amy is baking for her friends, and what she is baking is pies; or there are pies for her friends that Amy is baking. In the first instance, it is the action (baking), that is being modified, and for her friends in that instance would be a modifier of the VP, as in the summer was in the structure above. In the second instance, the object that Amy is baking is pies for her friends. If that were the case,  for her friends would not be a modifier of the VP and instead would be a modifier of the NP, as shown in the structure below:

The slight differences in meaning between the two possible structures of the same sentence can be captured if we think about corresponding questions that could be asked. If you asked What does Amy bake for her friends? (where the PP is modifying the VP), an appropriate answer could be Pies, not cupcakes, where you are answering simply with nouns, no additional phrases added (because nothing else is branching from that NP). On the other hand, if you asked What does Amy bake? for this sentence, an appropriate answer could be Pies for her friends, not cupcakes for her family, which shows that the prepositional phrases are acting as modifiers distinguishing who the objects in question are for, not who she is baking for. In that instance, the PP would be a modifier of the NP, not the VP.

Step 4: Add CPs if there are any

Within your sentence, there may be multiple clauses. If that is the case, then you can expect a Complementizer Phrase to show up. The basic structure for a CP that occurs lower in the sentences’ tree is exactly like that CP that contains the entire sentence, described above. There are two types of CPs that can occur within a larger CP phrase: CPs for complement clauses, and CPs for relative clauses. Depending on the CP type, it will attach to the larger sentence in different ways. Because CPs for relative clauses show movement, they will be covered in the Drawing Question Syntax Trees. For now, we are going to cover the CPs that are complement clauses. How these in particular attach to the larger tree should be easy to remember: the CP for a complement clause should always occur as a complement to the phrase it is attaching to. Let’s consider the sentence Amy thinks that she will bake her pies. We already know the basic structure for Amy thinks. What about that she will bake her pies? This is what we call a complement clause, which contains a ‘mini-sentence’ of sorts — this same clause could stand alone as the sentence She will bake her pies.

Notice that the structure of that she will bake her pies is exactly like that of what we would make for the sentence she will bake her pies, except that the word that introduces the complement clause (that) occupies the head position of the CP. Overall, the entire CP attaches as a complement to the VP contained within the higher CP. In fact, it may be handy to remember that in English, at least, a complement clause will always attach to a VP as a complement — complement clauses do not attach to NPs. 

Now that you understand how to draw syntax trees for sentences, you are ready to learn how to draw trees for questions, as well.

How To Draw A Syntax Tree, Part 8: A Step / 2023

I’ve talked previously about all the different possibilities for what constitutes a syntax tree, but not about how you get from “here’s how you’re supposed to represent things” to actually drawing a tree yourself. And that’s a pity, because I’ve actually got a really nice series of steps that I’ve developed from teaching, TAing, and tutoring.

Here are the steps in a nutshell: I’m going to go through them one at a time.

1. Label parts of speech2. Label main constituentsStep 1: Label parts of speech 3. Draw tree

Note: I recommend doing all of these steps by hand if at all possible. You’ll see from the photos and gifs below that it was easier for me to break out the paper and markers than to try to represent this electronically. If you want to type up your tree later, here are some tools for doing so, but it’ll be much easier to type up from an existing handwritten draft rather than try to do the thinking and the typesetting as part of the same step. Pencil or even a chalkboard/whiteboard is often a good idea for tree-drafting, and you’ll get better at figuring out spacing as you practice more.

So what do these steps look like in practice? Note that rather like learning to ride a bicycle, the extended description looks long and complicated, but with practice many of the steps become automatic with time.

You’re going to start with your sentence just written out normally – feel free to use the version that you get printed on your test or assignment, or write it out for yourself on scrap paper. If you’re writing it out yourself, it’s a good idea to leave extra space between the words, for the sake of the next step.

One easy way to keep track of parts of speech is to learn a keyword or two that unambiguously belongs in each category, and then when you’re trying to figure out whether another word belongs to that category, you can say “could I replace it with this other word that I know the lexical category of?” Here’s a sample list:

Noun – cat, happinessVerb – see, laughAdjective – blue, happyAdverb – quicklyPreposition – inDeterminer – theComplementizer – if, whetherAuxiliary – couldDegree word – very, nearly

Step 2: Label main constituents

(Note: do not use “that” as a keyword, because it can be a determiner, as in “that cat”, or a complementizer, as in “I saw that the cat was purring”. Compare what happens when you substitute them: “the cat” but not “*if cat”, “*whether cat”, and “I saw whether the cat was purring” but not “*I saw the the cat was purring”. “Be” and “have” are sometimes verbs as in “I am/have a cat”, sometimes auxiliaries, as in “I was laughing/have laughed” and your course may have particular conventions distinguishing them from modal auxiliaries like can, could, may, might, shall, should, will, would.)

In general, this step is going to end up with essentially the same results regardless of what theory your course is using. Apart from the auxiliaries and degree words/modifiers things, the only other part where I’d expect variation is depending on how your course treats pronouns and maybe proper names, so just check whether you’re using NP, N, D, etc for them.

Why are we doing this step? Rather than rushing into drawing a tree right away, this step will make sure you get all the labels for each node correct and don’t forget anything. Move on to step 2 once all words are labelled.

Here’s a image of step 1: I labeled the words starting with the more obvious content words and then adding in the less obvious function words, but you can do it in any order that makes sense.

Once you’ve gotten everything labelled, you want to figure out the constituents and the main relationships between various parts of the sentence. Your goal for this step is to get every head inside its own phrase: for every N, you need to figure out what its NP is, for every V, you figure out its VP, etc. If you’re doing bar levels, you might label a couple of those at this step if you’ve got ambiguity or a whole lot of stuff inside a particular phrase, but for the routine bar levels you can just put them in at the next step.

BOTTOM-UP: Start by identifying the easy phrases that only have a word or two in them: AdjPs, AdvPs, and NPs are often fairly small. Then move on to slightly larger constituents, including PPs and more elaborate NPs (and DPs if you’re using them), then VPs and finally IPs and CPs, if necessary.

TOP-DOWN: Start by identifying the verb(s): if you’re drawing a sentence, there should be at least one of them.

What did YouTube do? [show that the cat played the piano] – VP

What did YouTube show? [that the cat played the piano] – CP

What did the cat do? [play the piano] – VP

What did YouTube show the cat played? [the piano] – NP

What was played? [the piano] – NP

Where did the cat play the piano? [YouTube] – NP

Where did the cat play the piano? *[YouTube showed] -not a constituent

Who played the piano? [the cat] – NP

This is also the point where, if there’s any movement that’s going on, you’ll want to “restore” the affected word(s) back to their original position(s). You may be able to do this with the same questions that you used to figure out subject and object, or if you’re dealing with a question, try answering it (“What did the cat play?” → “The cat (did) play the piano”, so your restored sentence is “The cat did play what?”).

YouTube showed that the cat played the piano, and Vimeo did __ too. ( __ = show that the cat played the piano – VP)

YouTube showed it (it=that the cat played the piano – CP)

The cat played the piano, and the dog did __ too. ( __ = play the piano – VP)

YouTube showed that the cat played it. (it = the piano – NP)

It showed that the cat played the piano. (it = YouTube – NP)

YouTube showed that s/he played the piano (s/he = the cat – NP)

Fortunately, there are a series of questions you can ask in order to figure out which phrases contain other phrases, and they’re known as constituency tests. Your course may give you a list of constituency tests – if not, here are two not-very-overlapping lists. Two very common types are questions and substitution. I’ll demonstrate them both below for various constituents in the sentence “YouTube showed that the cat played the piano.”



When you figure out that some string of words is a constituent, put square brackets around it and label what kind of constituent it is (NP, PP, VP, etc). I like to do this by hand because I can make the square brackets of different sizes or colours to keep track of them all. If you find it helpful, you can also use underlining, highlighting, or circles to group other elements. (Here’s an example of particularly enthusiastic colour usage.)

If we have an extra modifier of some sort, we can use the same tests to figure out what it modifies. For example, we can add several different prepositional phrases beginning with “in” to the sentence above:

YouTube showed that the cat played the piano in a blue shirt.YouTube showed that the cat played the piano in high definition.YouTube showed that the cat played the piano in the living room.

But [in something] doesn’t necessarily modify the same thing each time, so we need to ask questions about it:

What was in a blue shirt? The cat (playing), not YouTube or the piano.What was in high definition? YouTube’s showing, not the cat or the piano.What was in the living room? The piano (or maybe the cat playing) but not YouTube.

And based on the answers to these questions, we can mark up the sentence as follows:

YouTube showed that the cat [ played the piano in a blue shirt ]VP YouTube [ showed [ that the cat played the piano ]CP in high definition ]VPYouTube showed that the cat played [ the piano in the living room ]NP

Why are we doing this step? This step is where most of the thinking happens: the goal is to know exactly what you’re putting in your tree before any of the tree-drawing actually happens. Otherwise it’s tempting to just draw a general shape that looks kind of like the trees you’ve seen before without fully examining what each part is contributing, which will end up as a mess. No really. It will.

As you get more practised at drawing trees, this step will take less time and you can skip over the easy parts if you want. For example, if parts of speech are 100% intuitive to you, you may be able to go right to labeling the constituents. Or you may not need to draw brackets around all the AdjPs and NPs, you can just figure out the subject and object and any ambiguities. But even once you’re fairly good at tree-drawing, if you’re ever faced with an unexpectedly daunting sentence to draw, you can always fall back on step 1: label the words and step 2: label the constituents. Or, if you’re drawing a really high-stakes tree, for a test or an assignment, you may still want to proceed as methodically as possible to reduce your chances of making a silly mistake.

Note that I have not gotten into sentence-level projections (i.e. S or IP or TP, whichever you’re using). There’s a reason for that: first of all, that’s where there’s the most variance between course conventions. Secondly, this is the type of projection that may not have an obvious head (unless you have an Aux and your course is treating Aux as an I head). And thirdly, you automatically need an S/IP/TP to contain your entire sentence, so it’s not a particularly informative constituent to add since it will literally just contain the whole sentence. BUT, and this is important, you also need another S/IP/TP for every additional verb that you have in your sentence, because any verb and associated words (subject, object, etc) could also be a sentence by itself.

For example:

YouTube showed that the cat played the piano.

Contains two verbs, “showed” and “played” and thus two clauses, each of which could be a sentence with minor modifications:

The main (or matrix) clause: “YouTube showed…”

The subordinate (or embedded) clause: “That the cat played the piano”

So we also need to split these up. We know that “that” is a complementizer ©, so it creates a CP (or S’ if you’re using it), but inside the CP is an S/IP/TP (directly inside every CP, in the position of sister to the C, is an S/IP/TP).

Step 3: Draw tree

[S/IP/TP YouTube showed [CP that [S/IP/TP the cat played the piano ] ] ]

However, if you only have one verb in your sentence, then you also only have one clause, the main clause, so you can skip this part.

And here’s a static image of the final result (note that I’ve labelled both sides of the brackets for extra clarity, but you don’t have to):

Now, finally, we get to draw the tree!

A lot of people think that this is the step that you start at, but unless you’re dealing with a really, really easy sentence and you already have practice drawing trees, jumping right into drawing a tree will just leave you confused and not sure what to put where. It’s a lot better to be confused at the previous step, where you can pause and try a couple things and figure it out, rather than at this step, where you’ll be tempted to just draw something that looks basically like a tree and think “eh, good enough”. Trust me, despite the fact that the rules may look confusing and arbitrary to you when you’re starting out, they make good sense to your prof or TA, and it will be very obvious to them if you do that.

I’m going to point out at this stage that syntax trees are not something you can bs. However, this is in fact a great and wonderful thing, because it means that you can, with enough effort, check your own work and prove that your tree is correct (or fix it if it’s not), and you are not at the mercy of dubious judgement calls and whether or not the prof likes you. A correct syntax tree is correct, a wrong (portion of a) syntax tree is wrong, and although there are a few fudgey bits in the realm of “how much do we care that this thing is wrong?”, it is entirely possible to get a score of 100% in a syntax course or unit.

Syntax (and in fact linguistics in general, actually) is not one of those subjects where the prof artificially caps the maximum score at 80 or 85: if you draw a completely correct tree, or in general demonstrate a very thorough understanding of the topic, you will get full marks, and for every mark you lose, there is something very specific that you should have done differently, and most profs and TAs will tell you exactly what answer they were looking for. It’s very satisfying. (I mean, until you get to high-level courses where you realize that what a syntax tree should even look like is still a matter of theoretical debate, but in an intro course there is definitely still a right answer.)

But enough with the pep talk: how do you take your now-thoroughly-marked-up sentence and make it into a tree?

You’re going to start at the top. As tempting as it may be to draw your sentence along the bottom of the page and draw up from there, this is not how syntax trees are conventionally drawn. Why? Well, starting from the top gives you more symmetrically-sized branches rather than long branches on one side and cramped, tiny, hard-to-read ones on the other, as well as more space for movement arrows. It’s also how the vast majority of syntax trees are drawn, and it’s easier for everyone to interpret each other’s trees if we follow a few basic formatting conventions.

If you’re worried about spacing, note that English trees will branch more on the right than on the left, so starting your S/IP/TP about a third of the way over on the left side of the page at the very top is generally better than starting it in the middle. Or just find an empty classroom and practise on a large whiteboard/chalkboard where you don’t need to worry about wasting paper. Thanks to the miracles of modern technology, you can even take a photo of your whiteboard tree when you’re finished, which was definitely not a thing when I was an undergraduate.

(Related: do not, for the love of Chomsky, draw your syntax trees upside-down. That is, do not write the sentence along the top of the page and draw branches down from it. I’ve gotten one or two of these in every stack of syntax assignments I’ve marked, and while I do always try to mark it as much as possible, it takes me about three times as long to figure out what’s going on and hence makes me grumpy. And you don’t want a grumpy person marking your assignment. If you want to instead make your marker especially happy, I have gotten some delightfully entertaining drawings from students on tests and assignments over the years, so you know, feel free.)

So you’re going to start at the top of the page with your maximal sentence projection, S or IP or TP (that’s S’ or CP if you’ve got a question), and proceed down from there.

What’s in your subject? Put it all under that subject position.

Make sure to include bar levels if your course is using them.

Do you have anything modifying your verb? Put it under the VP (V’ if you’re using them).

What’s in your object? Put it all directly sister to your V.

Include bar levels again if relevant.

Do you have any embedded clauses? You’ve figured out what they’re embedded under in the previous step, now put them there. Be sure to include a CP (S’) and S/IP/TP before going into the subject, verb, etc of the embedded clause.

Is anything ambiguous? If you figured out an ambiguity in the previous step, there are a couple ways to proceed. If your course or assignment has mentioned ambiguity as an option, you should probably draw both trees and indicate which meaning each one corresponds to. If there’s a technical ambiguity but one interpretation is way more plausible than the other, and you haven’t been told to find ambiguities, you may be able to get away with just drawing the most plausible interpretation (although in that case, feel free to include a note to the marker). Draw ambiguities on separate trees though, not the same one.

If you need to draw movement, make sure you represent the original position and the moved position using whatever conventions your course is using (arrows, traces, etc).

If you’re using S, S will branch into an NP (subject) and a VP (containing V, the object NP, and maybe more) plus maybe other things.

If you’re using IP or TP, IP or TP will branch into NP (subject) and I’ or T’, which will branch into I or T and VP (containing V, the object NP, and maybe other things). (Or these NPs might all be DPs, if you’re using the DP hypothesis. If you’ve never seen a DP, just ignore everything I’m saying about them.)

Did you include all the words from the target sentence in your tree?

Does the tree, left to right, read in the same order as your target sentence? (After any movement has happened.) If this is not the case, you need to fix something.

Do all the words have their part of speech labels that you established at the beginning? (Double-check the tests you used at the labelling step if you want to be really careful.)

Is each head inside its corresponding maximal projection? (N inside NP, V inside VP, etc.)

If you’re doing strict X’ theory, do you have at least one bar level between each head and its maximal projection? (N’ between N and NP, V’ between V and VP, etc.)

Do you have any triangles? (Your instructor may use triangles. This is why you should not.)

Anyway, this first part is pretty much always the same for any sentence, which is why we didn’t really bother map out this top projection in the previous step.

If you have more than one verb, is each verb inside its own VP which is inside its own S/IP/TP? Is each non-matrix verb’s S/IP/TP inside its own S’/CP?

Is there any movement? If it’s a question, what would the statement version sound like? If there are multiple verbs, what would each mini clause sound like separately? If there is passive, what would the active version sound like?

What complements do you have, if any? Especially complements of PPs (generally NPs/DPs), or NPs and AdjPs (often PPs beginning with “of”). Are they in the right positions? (In X’ theory, a complement is sister to the head, so complement of a noun → sister to N, complement of an adjective → sister to Adj, etc. In a theory without bar levels, a complement is simply inside the phrasal level, so complement of a noun → inside its NP, complement of a verb → inside its VP, etc.)

What modifiers do you have, if any? AdjPs, AdvPs, chúng tôi does each modifier modify? Is it in the right position to do so? (In X’ theory, a modifier is sister to the bar level of the modified element, so modifying a noun → sister to its N’, modifying a verb → sister to its V’, etc. In a theory without bar levels, a modifier is simply inside the phrasal level of the modified element, so modifying a noun → inside its NP, modifying a verb → inside its VP, etc. Note that if you don’t have bar levels, there is no difference between a complement and a modifier.)

If you’re in X’ theory, another way of phrasing the previous two questions is: for every PP, is it a complement or a modifier? Is it in the appropriate position for which one it is? (AdjPs are almost always modifiers, unless they’re after a verb: “the blue shirt” = modifier; “the shirt is blue” = complement. I can’t think of any examples where an AdvP would be a complement and not a modifier, but you may want to double check just in case. And an AdvP might modify several different things, so especially check that part.)

What’s the subject (including modifiers & complements) of each verb? Is it in the appropriate subject position that your course is using? (Under S or sister to I’ are the most likely.)

What’s the object (including modifiers & complements) of each verb? Is it sister to the verb?

Do you have any ambiguity? If so, have you represented it clearly?

Now you’re going to take the constituents that you figured out in the previous step and get them into the tree:

When you think you’ve finished your tree, here are a few common errors that you can check:

Basic errors:

More specific errors:

This is part 8 of a series on how to draw syntax trees. If you’re confused about why I keep referring to different course conventions rather than giving a specific answer, check out the remainder of the series below.

Here’s a gif of drawing the tree, again assuming you’re using a strict X-bar theory with IPs (note that the colours correspond to the colours of the brackets I used at the previous step – this is for your ease in following, it’s not a thing you need to do in drawing your own trees, as switching ink colours this often will probably make it harder).

And here’s the final tree as a still image:

Lastly, here are the brackets and the tree side-by-side, just for fun.

Notice that subjects are in spec, IP (sister to I’) of their respective IPs, and objects are in complement position of their respective verbs (sister to V). These trees assume you’re doing a strict X’ theory structure: if you’re using TPs or DPs, feel free to substitute them instead, and if you’re doing basic phrase structure rules, substitute S for IP and delete all the bar levels (just move everything up to attach directly to the phrase).

Phần Mềm Staruml Vẽ Sơ Đồ Use Case, Activity Diagrams, Sequence Diagrams / 2023

Hướng dẫn sử dụng Phần mềm StarUML, StarUML là phần mềm mã nguồn mở, có kích thước nhỏ gọn, hỗ trợ thiết kế với hầu hết các ngôn ngữ lập trình phổ biến hiện nay như C++, Java, C#, … giao diện thân thiện và là công cụ tuyệt vời hỗ trợ phân tích thiết kế theo hướng UML.

Phần mềm StarUML là phần mềm mã nguồn mở, có kích thước nhỏ gọn, hỗ trợ thiết kế với hầu hết các ngôn ngữ lập trình phổ biến hiện nay như C++, Java, C#, … giao diện thân thiện và là công cụ tuyệt vời hỗ trợ phân tích thiết kế theo hướng UML, hỗ trợ vẽ sơ đồ Use Case, Activity diagrams, Sequence diagrams tốt nhất hiện nay.

Trong bài này, chúng ta sẽ bàn về một số công cụ có thể dùng để biểu diễn và quản lý các bản vẽ UML một cách hiệu quả.

1. Giới thiệu các công cụ vẽ UML phổ biến

Có rất nhiều công cụ được sử dụng để vẽ các bản vẽ UML rất chuyên nghiệp như Rational Rose, Enterprise Architect, Microsoft Visio v.v.. và rất nhiều các công cụ phần mềm nguồn mở miễn phí có thể sử dụng tốt.

Các công cụ có cách sử dụng khá giống nhau và ký hiệu của các bạn vẽ trên UML cũng đã thống nhất nên việc nắm bắt một công cụ khi chuyển sang làm việc với một công cụ khá không quá khó khăn.

Trong bài này, xin giới thiệu với các bạn công cụ Start UML, một phần mềm nguồn mở, miễn phí, có đầy đủ chức năng và có thể sử dụng tốt trên môi trường Windows.

2. Giới thiệu về Start UML

Cài đặt

Bạn có thể download bộ cài đặt của phần mềm Start UML tại Sau khi download và tiến hành các bước cài đặt chúng ta nhanh chóng có được công cụ này trên máy tính.

Các Model

Khởi động Start UML vào màn hình chính chúng ta có được các model như sau:

Hình 1. Cửa sổ giao diện của Start UML

Nhìn cửa sổ Model Explorer bên phải chúng ta nhận thấy có 5 model.

Use Case Model: chứa các bản vẽ phân tích Use Case

Analysis Model: chứa các bản vẽ phân tích

Design Model: chứa các bản vẽ thiết kế

Implementation Model: chứa các bản vẽ cài đặt

Deployment Model: chứa các bản vẽ triển khai

Tùy theo nhu cầu phân tích, thiết kế chúng ta xác định sẽ sử dụng model nào để thể hiện.

3. Cách tạo các Diagram

Để tạo các các bản vẽ, chúng ta chỉ cần chọn model mà bạn muốn sử dụng, kích phải chuột, chọn add diagram và chọn bản vẽ cần xây dựng.

Hình 2. Cách tạo ra một bản vẽ

Sau khi chọn bản vẽ, cửa sổ bên trái sẽ hiển thị thanh công cụ chứa các ký hiệu tương ứng của bản vẽ để bạn có thể vẽ được các bản vẽ một các dễ dàng.

Hình 3. Vẽ bản vẽ Use case

Việc xây dựng các bản vẽ chúng ta đã bàn kỹ trong các bài trước, bạn xem lại các bài trước và biểu diễn lại các bản vẽ này lên Start UML.


4. Kết luận

Như vậy, chúng ta đã nghiên cứu qua tất cả các bản vẽ UML được sử dụng phổ biến trong OOAD. Đến đây, bạn đã có đủ kiến thức và kỹ năng để phân tích và thiết kế một phần mềm. Bây giờ bạn hãy cố gắng thực hành phân tích và thiết kế các hệ thống phần mềm để có thêm kinh nghiệm.

Các kiến thức này các bạn có thể dùng để phân tích và thiết kế một phần mềm mới hoặc dùng để mô tả nghiên cứu một phần mềm hoặc framework có sẵn nhằm phục vụ cho việc hiệu chỉnh phần mềm cho phù hợp với nhu cầu của khách hàng.

Trong một số trường hợp, cách thức cài đặt (codding) có thể khác với các bản vẽ thiết kế mà bạn đã tìm hiểu ở trên gây khó hiểu cho bạn. Đó là khi các hệ thống ấy sử dụng các Design Pattern như MVC Pattern, Delegate, Façade …. Vấn đề này chúng ta sẽ bàn trong chuyên mục “Design Pattern” trong thời gian tới hoặc bạn có thể tự nghiên cứu để hiểu thêm về vấn đề này.

Thự Hành Xây Dựng Bản Vẽ Activity Diagram / 2023

Trong bài trước chúng ta đã nắm được khái niệm, các thành phần, cách xây dựng và ứng dụng của Activity Diagarm. Bây giờ, chúng ta áp dụng nó để phân tích nghiệp vụ cho hệ thống eCommerce mà chúng ta đã xem xét trong bài số 3 của chuyên mục này.

Xây dựng Activity Diagram cho hệ thống eCommerceBước 1: Xác định các nghiệp vụ cần phân tích.

Trước tiên, chúng ta xem xét các Use Case. Về nguyên tắc bạn phải phân tích và mô tả tất cả các nghiệp vụ của hệ thống để làm rõ hệ thống. Xem xét bản vẽ Use Case Diagram chúng ta đã vẽ ở bài 3, chúng ta có thể thấy các Use Case sau cần làm rõ: – Xem sản phẩm theo chủng loại – Thêm sản phẩm theo nhà cung cấp – Thêm giỏ hàng – Chat – Quản lý đơn hàng – Thanh toán – Theo dõi chuyển hàng – Đăng nhập

Tiếp theo, chúng ta bắt đầu phân tích và vẽ cho chức năng xem sản phẩm theo chủng loại.

Để thực hiện chức năng xem sản phẩm theo chuẩn loại hệ thống sẽ thực hiện như sau: – Điều kiện ban đầu: ở trang chủ – Điều kiện kết thúc: hiển thị xong trang sản phẩm

Các bước như sau: – Người dùng chọn loại sản phẩm. – Hệ thống sẽ lọc lấy loại sản phẩm tương ứng, sau đó lấy giá, lấy khuyến mãi cho tất cả các sản phẩm đã được chọn và hiển thị lên màn hình. – Người dùng xem sản phẩm.Bước 3: Thực hiện bản vẽ – Chúng ta thấy có 2 đối tượng tham gia vào giao dịch này là Người dùng và Hệ thống. Chúng ta nên dùng Swimlance để thể hiện 2 đối tượng trên.

– Hành động tiếp theo là Guest chọn loại sản phẩm

Kết luận

Bản vẽ Activity Diagram sẽ giúp bạn mô tả nghiệp vụ của hệ thống một cách nhanh chóng, nó là công cụ hiệu quả trong việc mô tả hoạt động nghiệp vụ của hệ thống. Do vậy, các bạn hãy thực hành và sử dụng thành thạo bản vẽ này để thuận lợi trong việc phân tích, thiết kế hệ thống sau này.

Trong bài tiếp theo chúng ta sẽ thiết kế các chức năng của hệ thống thông qua việc sử dụng Sequence Diagram. Mời các bạn đọc tiếp.

Bài tiếp: Bản vẽ Sequence Diagram

Bài trước: Bản vẽ Activity Diagram