Skip to content

Commit 3e78ba3

Browse files
committed
2 parents 0c984d7 + 655d229 commit 3e78ba3

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ os:
55
- linux
66

77
smalltalk:
8-
- Pharo-stable
8+
- Pharo64-7.0
99

1010
env:
1111
global:

Chapters/SimpleLAN/SimpleLAN.pillar

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!! A simple network simulator
1+
!! A simple network simulator
22
@ch:lan
33

44
In this chapter, we develop a simulator for a computer network, step by step from scratch.
@@ -229,8 +229,8 @@ Again, all the tests should now pass.
229229

230230
!!! Making our objects more understandable
231231

232-
When programming we often make mistakes and it is important to help developer to address them. Let us put a breakpoint and
233-
try to understand the objects.
232+
When programming we often make mistakes and it is important to help developer to address them. Let us put a breakpoint and
233+
try to understand the objects.
234234

235235
[[[language=smalltalk
236236
KANetworkEntitiesTest >> testNodeLinking
@@ -243,7 +243,7 @@ KANetworkEntitiesTest >> testNodeLinking
243243
self assert: (node1 hasLinkTo: node2)
244244
]]]
245245

246-
Running the test will open a debugger as the one shown in Figure *@debugger*. We get object but their textual representation is too generic to really help us.
246+
Running the test will open a debugger as the one shown in Figure *@debugger*. We get object but their textual representation is too generic to really help us.
247247

248248
+Navigating specific objects having a generic presentation.>file://figures/debugger.png|width=100|label=debugger+
249249

@@ -331,7 +331,7 @@ KANetworkLink >> initialize
331331
KANetworkLink >> emit: aPacket
332332
"Packets are not transmitted right away, but stored.
333333
Transmission is explicitly triggered later, by sending #transmit:."
334-
334+
335335
packetsToTransmit add: aPacket
336336
]]]
337337

@@ -381,7 +381,7 @@ KANetworkLink >> transmit: aPacket
381381

382382
At that point all our tests should pass.
383383
Note that the message ==notYetImplemented== is not called, since our tests do not yet require routing.
384-
Figure *@Api2* shows that the API of our classes is getting richer than before.
384+
Figure *@Api2* shows that the API of our classes is getting richer than before.
385385

386386
+Richer API.>file://figures/API2.pdf|width=90|label=Api2+
387387

@@ -391,7 +391,7 @@ Figure *@Api2* shows that the API of our classes is getting richer than before.
391391
On a real network, when a node wants to send a packet to itself, it does not need any connection to do so.
392392
In real-world networking stacks, loopback routing shortcuts the lower networking layers; however, this is finer detail than we are modeling here.
393393

394-
Still, we want to model the fact that the loopback link is a little special, so each node will store its own loopback link, separately from the outgoing links. We start to define a test.
394+
Still, we want to model the fact that the loopback link is a little special, so each node will store its own loopback link, separately from the outgoing links. We start to define a test.
395395

396396
[[[language=smalltalk
397397
KANetworkEntitiesTest >> testLoopback
@@ -484,7 +484,7 @@ KANetworkTest >> setUp
484484
self buildNetwork
485485
]]]
486486

487-
Before anything else, let's write a test that will pass once we've made progress; we want to access network nodes given only their addresses. Here we check that we get a hub node based on its address:
487+
Before anything else, let's write a test that will pass once we've made progress; we want to access network nodes given only their addresses. Here we check that we get a hub node based on its address:
488488

489489
[[[language=smalltalk
490490
KANetworkTest >> testNetworkFindsNodesByAddress
@@ -507,7 +507,7 @@ KANetworkTest >> buildNetwork
507507
net := KANetwork new.
508508
hub := KANetworkNode withAddress: #hub.
509509
#(mac pc1 pc2 prn)
510-
do: [ :addr |
510+
do: [ :addr |
511511
| node |
512512
node := KANetworkNode withAddress: addr.
513513
net connect: node to: hub ].
@@ -540,7 +540,7 @@ KANetwork >> makeLinkFrom: aNode to: anotherNode
540540
]]]
541541

542542

543-
We add a low level method ==add:== to add a node in a network.
543+
We add a low level method ==add:== to add a node in a network.
544544

545545
[[[language=smalltalk
546546
KANetwork >> add: aNode
@@ -645,7 +645,7 @@ KANetwork >> linkFrom: sourceAddress to: destinationAddress
645645
... Your code ...
646646
]]]
647647

648-
!!!! Final check.
648+
!!!! Final check.
649649
As a final check, let's try some of the previous tests, first on the isolated ==alone== node, showing that loopback works even without a network connection:
650650

651651
[[[language=smalltalk
@@ -762,7 +762,7 @@ KANetworkNode >> forward: aPacket from: arrivalLink
762762

763763
!!! Introducing a new kind of node
764764

765-
Now we define the class ==KANetworkHub== that will be the recipient of hub specific behavior.
765+
Now we define the class ==KANetworkHub== that will be the recipient of hub specific behavior.
766766

767767
[[[language=smalltalk
768768
KANetworkNode subclass: #KANetworkHub
@@ -785,15 +785,15 @@ Now we can use a proper hub in our test, replacing the relevant line in ==KANetw
785785
]]]
786786

787787

788-
You have now a nice basis for network simulation. In the following we will present some possible extensions.
788+
You have now a nice basis for network simulation. In the following we will present some possible extensions.
789789

790790

791791
!!! Other examples of specialized nodes
792792
In this section we will present some extensions of the core to support different scenarios. We will propose some tasks to make sure that the extensions are fully working. In addition in this section we do not define tests and we strongly encourage you to start to write tests. At the moment of the book you should be ready to write your own tests and see their values to improve your development process. So take this opportunity to practice.
793793

794794
!!!! Workstations counting received packets
795795

796-
We would like to know how many packets specific nodes are receiving.
796+
We would like to know how many packets specific nodes are receiving.
797797
In particular when a workstation consumes a packet, it simply increments a packet counter.
798798

799799
Let's start by subclassing ==KANetworkNode==:
@@ -821,7 +821,7 @@ KANetworkWorkstation >> consume: aPacket
821821
receivedCount := receivedCount + 1
822822
]]]
823823

824-
Define accessors and the ==printOn:== method for debugging.
824+
Define accessors and the ==printOn:== method for debugging.
825825
Define a test for the behavior of workstation nodes.
826826

827827

@@ -840,7 +840,7 @@ KANetworkNode subclass: #KANetworkPrinter
840840

841841
[[[language=smalltalk
842842
KANetworkPrinter >> consume: aPacket
843-
supply > 0 ifTrue: [ ^ self "no paper, do nothing" ].
843+
supply > 0 ifFalse: [ ^ self "no paper, do nothing" ].
844844

845845
supply := supply - 1.
846846
tray add: aPacket payload
@@ -871,7 +871,7 @@ KANetworkPrinter class >> withAddress: anAddress initialSupply: paperSheets
871871
yourself
872872
]]]
873873

874-
Define accessors and the ==printOn:== method for debugging purpose.
874+
Define accessors and the ==printOn:== method for debugging purpose.
875875
Define some test methods for the behavior of printer nodes.
876876

877877

@@ -910,7 +910,7 @@ Making this work properly will require replacing hubs with routers and flood rou
910910

911911
+A possible extension: a more realistic network with a cycle between three router nodes. >file://figures/lan-routes.pdf|width=50|label=routing+
912912

913-
Here is a possible setup for a new family of tests.
913+
Here is a possible setup for a new family of tests.
914914

915915
[[[language=smalltalk
916916
KARoutingNetworkTest >> buildNetwork

0 commit comments

Comments
 (0)