This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ScoreCounter: | |
| def __init__(self): | |
| self.pins_down = None | |
| def roll(self, pins_down): | |
| self.pins_down = pins_down | |
| def score(self): | |
| return self.pins_down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def multiply(a, b), do: a * b | |
| def main(args) do | |
| {a, b} = read_from_command_line(args) | |
| result = multiply(a, b) | |
| print_human_readable_result({a, b}, result) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #################### | |
| ### RESULT ### | |
| #################### | |
| // Hello, I am a human readable result! // | |
| Computation: "2 * 2" | |
| |> Result: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The classic scenario - Server-side rendering | |
| Don't fear the complex name, Server-side rendering is actually a pretty simple process. | |
| To understand, let's first imagine a simple non-web application: A command line application. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <h1>This is the result</h1> | |
| <p>$$$$$$$</p> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <h1>This is the result</h1> | |
| <p>4<p> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="menu" style="visibility: hidden"> | |
| | | |
| Javascript: when clicking menu, do: | | |
| V | |
| <div id="menu" style="visibility: visible"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"book": { | |
| "title": "Moby Dick", | |
| "author": "Herman Melville", | |
| "reviews": [ | |
| {"reviewer": "Mark234", "rating_stars": "4.5"}, | |
| {"reviewer": "Frank12", "rating_stars": "3.5"}, | |
| {"reviewer": "NotPatrick", "rating_stars": "4"}, | |
| ] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RequestMapping("/itinerarySelection") | |
| public String showItinerarySelection(Request request, Model model) { | |
| // Retrieve ID (Here stored with the client) | |
| String trackingId = request.getParameter("trackingId"); | |
| ////////////////////////////////// | |
| // Query the Application layer // | |
| ////////////////////////////////// | |
| List<RouteCandidate> routeCandidates = | |
| bookingService.requestPossibleRoutesForCargo(trackingId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface BookingService { | |
| TrackingId bookNewCargo(Location origin, Location destination); | |
| CargoRouting findCargoRoutingInformations(TrackingId Id); | |
| List<RouteCandidateDTO> requestPossibleRoutesForCargo(TrackingId id); | |
| void assignCargoToRoute(TrackingId id, RouteCandidate route); | |
| void changeDestination(TrackingId id, String destinationUnLocode); |
OlderNewer