On this page:
Software Development
Home
7.4.0.10

Software Development

Software Development

I expect students to visit this page once per 24 hours starting with the first day of the semester.

image Monday, October 14th, 2019 5:33:19pm

For some reasons, the Saturday revision of 5 — Observing Players was not synced properly with the CCIS web server. Please re-visit and note the clarifications.

Friday, October 11th, 2019 5:29:23pm

Here are some essential announcements for the week starting Monday, Oct. 14:

Monday, October 7th, 2019 12:19:26pm

I have added some clarifications to 4 — The Rules (summarizing Piazza posts) and to Tsuro, A Local Protocol.

Tuesday, October 1st, 2019 9:06:05pm

General now comes with images so that you recognize the teaching assistants when you go to their office hours.

Saturday, September 28th, 2019 6:53:18pm

I hadn’t finished editing the tile-generating code on Friday for lecture, so I thought I’d post my Racket version of the code here. Please take a look to see where I add comments and where I rely on the name of the function, method, or module to convey an interpretation. Additionally, you may wish to study the algorithm itself, especially in case you struggled. Irrespective of the representation of tiles and edges plus the syntax of the solution, the essence should be similar.

Since we are given a test, let’s state it up front:
#lang racket
 
(module+ test (require rackunit))
 
(define TILES# 35)
 
(module+ test
  (check-equal? (length all-tile-types) TILES# "check number of tiles"))

Next we need a representation for edges ...
(module edge-representation racket
  (provide
    ; type Edge
    edge
    edge-from
    edge-to)
 
  ; type Edge = [List Port Port]
  (define edge list)
  (define edge-from first)
  (define edge-to second))
(require (submod "." edge-representation))

... and tiles, which we construct from a list of four edges:
(module tile-representation racket
 
  (provide
    ; type Tile
 
    ; [List Edge Edge Edge Edge] -> Tile
    create-tile
 
    ; {Tile Tile -> Boolean}
    rotate-=?)
 
  (require SwDev/Lib/or)
  (require (submod ".." edge-representation))
  (require Tsuro/Code/Common/port)
 
  (struct tile [lo4edges] #:transparent)
 
  (define (create-tile edges)
    (tile (sort edges <-port #:key edge-from)))
 
  (define (rotate-=? c1 c2-0)
    (or~ (equal? c1 c2-0)
         #:let c2-1 (rotate-tile c2-0)
         (equal? c1 c2-1)
         #:let c2-2 (rotate-tile c2-1)
         (equal? c1 c2-2)
         #:let c2-3 (rotate-tile c2-2)
         (equal? c1 c2-3)))
 
  ; {Tile [#:degree Degrees] -> Tile}
  (define (rotate-tile c0 #:degree (d 90))
    (cond
      [(zero? d) c0]
      [else
       (define rotated-edges
         (for/list ((e (tile-lo4edges c0)))
           (define 90from (90degrees (edge-from e)))
           (define 90to   (90degrees (edge-to e)))
           (if (<-port 90from 90to) (edge 90from 90to) (edge 90to 90from))))
       (rotate-tile (create-tile rotated-edges) #:degree (- d 90))])))
(require (submod "." tile-representation))
My actual tile representation adds a mechanism for applying the tile to a port, as if it were a function, to retrieve the connected one. The data representation and its interpretation take half a laptop screen.

Now we can write down the algorithm for generating the 35 distinct tiles, modulo rotations by 90, 180, and 270 degrees:
(require Tsuro/Code/Common/port)
 
; generate all 35 unique tlle configurations
 
; {[Listof Port] -> [Listof [Listof Edge]]}
; for the given 2 * N ports, create list of all possible N edges
; GENERATIVE by removing 2 ports, we get closer to the empty case
[define (all-edges-for 2*n-ports)
  (cond
    [(empty? 2*n-ports) '(())]
    [else
     (define from (first 2*n-ports))
     (define others (rest 2*n-ports))
     (for/fold ([result '()]) ((to others)) ; < loop collects gen.-rec. results
       (define the-edge (edge from to))
       (define n-ports  (remove to others))
       (define other-edges (all-edges-for n-ports)) ; < generative recursion
       (define with-edge (map (λ (1other) (cons the-edge 1other)) other-edges))
       (append with-edge result))])]
 
; [Listof Tiles]  
(define all-tile-types ; loop eliminates rotated tiles
  (for/fold ((set '())) ((lc (all-edges-for PORTS)))
    (define next (create-tile lc))
    (if (memf (curry rotate-=? next) set) set (cons next set))))

Monday, September 16th, 2019 9:40:23am

On Tuesday we will do some in-class software development. Please coordinate with your partner so that every pair has at least one laptop in class. Thanks.

Saturday, September 14th, 2019 12:20:32pm

I have modified C — Exploring Your TAHBPL Some More to fix a mistake, clarify a bullet, and explain some terminology that may have gotten lost in the lecture. While this terminology isn’t all that important, clear terminology is always helpful when all parties accept and understand it.

Friday, September 13th, 2019 6:00:42pm

Industrial people are slowly recognizing the downside of ticket-driven software development. Considering reading the Jon Evans’s blog post to get a sense of what these people are getting at.

Friday, September 13th, 2019 12:33:36pm

netcat (abbreviated nc) is the best way to manually send JSON information from your shell to your server:

    [login-faculty] $ cat test-input.json | nc login-faculty.ccs.neu.edu 45678

This command connects the cat command with the nc command via a pipe, a combination that is also available on your macOS. Specifically it sends the content of the test-input.json file to nc, which in turn transmits it to the computer with the IP address login-faculty.ccs.neu.edu at port 45678 (if all of you use 8000 on the same computer, bad things will happen).

Here is a demo screen shot from my computer:

In this example, I am using nc to send JSON from login-faculty to a computer called antarctica, also on the ccs.neu.edu network.

In the right shell window I start ./C up, waiting to connect with a single client. Then in the left window I first display the content of the test file to the shell, before I use the command combination from above to send it to the “server” in the right window. As soon as the server has done its work for the client, it shuts down—of course after sending back the correct answer to the client, which displays the answer in the shell.

Thursday, September 5, 2019 10:44:25am

Please prepare a letter-size sheet of paper by folding it lengthwise, writing down the name of your favorite programming language on one side and placing it in front of you on your desk. ~~ You will get the chance to build a large code base in this language so that the instructor’s taste in PL won’t inhibit your amazing programming skills.

image

Even Congress Doesn’t Understand Why Software Engineers Take So Long

Even Congress Can't Wait for Software