Programming for beginners
1,016 FOLLOWERS
Programming Languages ABAP C# Groovy Haskell Java JavaScript Julia Kotlin Prolog Python R Tutorial Esoteric Program...
Programming for beginners
7h ago
‘global’ keyword is used to define and access global variables.
Example
!global $counter = 1
!global $counter = $counter + 1
globalVariables.txt
@startuml
!global $counter = 1
!function $sum($a, $b)
!global $counter = $counter + 1
!return $a + $b
!endfunction
!function $sub($a, $b)
!global $counter = $counter + 1
!return $a - $b
!endfunction
!$a = 20
!$b = 5
sys1 -> sys2 : $counter. Sum of $a and $b is $sum(20, 5)
sys1 -> sys2 : $counter. Sub of $a and $b is $sub(20, 5)
!$a = 25
!$b = 15
sys1 -> sys2 : $counter. Sum of $a and $b is $su ..read more
Programming for beginners
7h ago
Using the keyword !startsub, !endsub, !includesub, you can specify subparts and include them in a file.
Define part
!startsub SubPart1
S1 -> S2 : SubPart1 msg1
S1 -> S3 : SubPart1 msg2
S1 -> S4 : SubPart1 msg3
!endsub
Use the part
!includesub parts.txt!SubPart1
parts.txt
@startuml
!startsub SubPart1
S1 -> S2 : SubPart1 msg1
S1 -> S3 : SubPart1 msg2
S1 -> S4 : SubPart1 msg3
!endsub
!startsub SubPart2
D1 -> D2 : SubPart2 msg1
D1 -> D3 : SubPart3 msg2
D1 -> D4 : SubPart3 msg3
!endsub
@e ..read more
Programming for beginners
13h ago
‘includeurl’ directive include the ‘plantuml’ data from given url this file
includeURL.txt
@startuml
!define AWSPUML https://raw.githubusercontent.com/milo-minderbinder/AWS-PlantUML/release/18-2-22/dist
!includeurl AWSPUML/common.puml
!includeurl AWSPUML/Storage/AmazonS3/AmazonS3.puml
!includeurl AWSPUML/Storage/AmazonS3/bucket/bucket.puml
AMAZONS3(s3_internal)
AMAZONS3(s3_partner,"Vendor's S3")
s3_internal <-- s3_partner
@enduml
Above snippet generate below diagram.
Previous   ..read more
Programming for beginners
1d ago
What is a data center?
Data centers are gaint buildings that hosts tens of thousands of interconnected servers and an array of cooling systems. Due to security concerns, access to these facilities is typically restricted to very few employees.
Core components of Data center
1. Network Infrastructure
The network infrastructure acts as the central nervous system of the data center, connecting various components such as physical and virtual servers, storage units, data center services, and external connections to reach end-user destinations.
2. Storage Infrastructure
Storage ..read more
Programming for beginners
1d ago
!include directive
We can include files in our program using !include directive. This feature is helpful in reusing the components in many diagrams.
For example, let’s define list.txt file.
list.txt
interface Collection{
}
interface Iterable {
Iterator iterator()
}
interface List{
int size()
void clear()
boolean add(E e)
void add(int index, E element)
addAll(Collection<? extends E> c)
void clear()
boolean contains(Object o)
}
Collection <|-- List
Iterable <|-- List
Let’s use the conte ..read more
Programming for beginners
1d ago
Functions, procedures can also be called using keyword arguments, i.e, by using argument names.
Example
!function $sum($a, $b)
!global $counter = $counter + 1
!return $a + $b
!endfunction
Above function can be called in following ways.
$sum($b=45, $a=5)
$sum($b=45, 5)
$sum(5, 45)
keywordArguments.txt
@startuml
!global $counter = 1
!function $sum($a, $b)
!global $counter = $counter + 1
!return $a + $b
!endfunction
sys1 -> sys2 : $counter. sum of 5 and 45 is $sum($b=45, $a=5)
sys1 -> sys2 : $counter. sum of 5 and 45 is $sum($b=45, 5)
sys1 -> ..read more
Programming for beginners
1d ago
You can assign default values to function or procedure parameters.
!function $sum($a=5, $b=6)
!global $counter = $counter + 1
!return $a + $b
!endfunction
$sum() : Since I do not pass any arguments, a =5, b=6 are used here
$sum(20): a= 20, b=6
$sum(20, 30): a=20, b=30
defaultValues.txt
@startuml
!global $counter = 1
!function $sum($a=5, $b=6)
!global $counter = $counter + 1
!return $a + $b
!endfunction
sys1 -> sys2 : $counter. sum() is $sum()
sys1 -> sys2 : $counter. sum(20) is $sum(20)
sys1 -> sys2 : $counter. sum(20, 30) is $sum(20 ..read more
Programming for beginners
2d ago
A function name should starts with $ and all the argument names should start with $.
Unlike procedures, a function can return a value.
A function can be called from other function and can be called from other procedure.
functions.txt
@startuml
!function $sum($a, $b)
!return $a + $b
!endfunction
!function $sub($a, $b)
!return $a - $b
!endfunction
!$a = 20
!$b = 5
sys1 -> sys2 : Sum of $a and $b is $sum(20, 5)
sys1 -> sys2 : Sub of $a and $b is $sub(20, 5)
@enduml
Above snippet generate below diagram.
If a function has one liner body ..read more
Programming for beginners
2d ago
PlantUML support procedures, where you can define once and reuse.
a. Procedure names should start with a $
b. Argument names should start with a $
c. Procedures can call other procedures
procedures.txt
@startuml
!procedure $fib($arg)
!$a = 0
!$b = 1
!$counter = 0
!$fib = 0
!while $counter < $arg
#DarkSalmon:for the iteration $counter;
#palegreen:a=$a, b=$b;
!$fib = $a + $b
!$a = $b
!$b = $fib
#pa ..read more
Programming for beginners
2d ago
!while, !endwhile keywords are used to define loops.
loops.txt
@startuml
!procedure $fib($arg)
!$a = 0
!$b = 1
!$counter = 0
!$fib = 0
!while $counter < $arg
#DarkSalmon:for the iteration $counter;
#palegreen:a=$a, b=$b;
!$fib = $a + $b
!$a = $b
!$b = $fib
#palegreen:fib=$fib;
!$counter = $counter + 1
!endwhile
!endprocedure
start
$fib(5)
end
@enduml
Above snippet shows what is happening in each iteration of fibo ..read more