On this page:
Software Engineering
Home
8.7

Software Engineering

Software Engineering

I expect you to visit this page at least once per 24 hours.

image Tue, December 13, 2022 1:04:16 PM

I have several things for you:
  • You should now have the file in the 2022-12-12 sub-directory in your personal repository to submit your review of yesterday’s code walk.

  • You will also have, in the top level of that repository, a file named ok+okok-0

    • On the first line, write a 2-3 digit number between 0 and 100, inclusive, representing the numeric score you wish to associate with an ok+

    • On the second line, write a 2-3 digit number between 0 and 100, inclusive, representing the numeric score you wish to associate with an ok

    • On the third line, write a 2-3 digit number between 0 and 100, inclusive, representing the numeric score you wish to associate with an ok-

    • On the fourth line, write a 2-3 digit number between 0 and 100, inclusive, representing the numeric score you wish to associate with a 0

    • In addition, to be a valid submission, your choices must be monotonically decreasing. That is, e.g. an ok+ cannot be given a grade lower than an ok.

  • Bring your Lab Book book with you when you come for your final code walk. I will collect it from you during that time. I will keep it, to assess that part of your grade, and leave them in my department mailbox for you to collect.

  • I will conduct final code walks in the Math and Computer Science conference room in the 2nd floor of McQuaid Hall. If you do not know where this is, please plan to meet me at my office just before the time of your review. Partners should come in pairs. Plan to be there for the usual 30 minutes, and please practice setting up your display technology ahead of time. Available times are Thurs 12/15 9AM-12:30pm and Tues 12/20 9AM-5PM. Sign up by email, first-come first-served. If that does not work for you (and your partner, please one of you send me an email CCing the other stating your problem, and we can work it out.)

image

Thu, December 8, 2022 12:34:20 PM

Christmas Party

Our department Christmas party is Wednesday, 12/14/22 from 1130-2 in the Math and CS department suite. Please do come and enjoy, you are all invited!

image

Thu, December 8, 2022 12:28:44 PM

I apologize that I failed to release the last assignment on time. Thank you Eric for reminding me in the chat. Please now find that released, and find that I gave you two additional days to complete it, as compensation for that delay.

image

Thu, December 8, 2022 12:28:44 PM

Why Game Trees

I have spelled out the below rationale several times, but code I wanted to write this rational down once and for all.

Step 1: Rule Books Board games come with rule books, which are written in English. Everyone who has played a board game knows that different people interpret such rules in different ways, and people end up discussing interpretations during a game.

Since Fish will ask people to pay money to participate in "hey that’s my fish" tournaments, we must publish the rules of the game. We could use English. And we would get sued about different interpretations, and it would then be likely that we will end up getting fined. Some jury somewhere will side with the participant.

As I have mentioned Common/ represents the common ontology. As software developers, we have an obvious alternative to English: code. Instead of publishing the rules of the game in English only, we publish the code in Common/ and tell potential participants that "code rules." All they have to do is download it, read, and run the code. In case of a conflict we can point any jury to this code.

This strategy is effective only if the unpublished referee uses this rule book. If the referee re-implements the rule checking, any articulate expert will convince any jury that there is a conflict between the rule book and the referee’s re-implementation.

Step 2: Game Trees Using the game tree to represent the rule book is This choice roughly corresponds to the more European idea of law as rules that govern all known and future situations in a uniform manner. overkill. In an ordinary situation, it would suffice to implement the following components: rule-book on top of game-state, knowledge-about-player, board, and tile.

A semester does not leave enough time to implement these components according to the simulated real-world scenario. Or, if the department were to finally require a two-semester version of the course, the best option would be to split the game tree into
  • a rule-book milestone, to be published in the Common/ folder

  • a game-tree milestone, to be hidden in Player/.

But, a secondary requirement for any solid course on software development is the inclusion of one challenging milestone concerning data structures and algorithms. Ideally, this should involve "large data" or even a database.

This choice roughly corresponds to the American idea of case law. In classical AI and OR, it is common to work with tree representations of games, and as it turns out, using these trees satisfies both needs—those of the referee and those of the AI player—because they represent the rule book in one concrete manner:

all legal states and the transitions between them.

Since we wish to develop both players—for testing and for house player purposes—we might as well use the game tree as a representation of the rule book.

The Racket Implementation Here are the essential snippets from my Racket implementation of this project:
(define choice-failed .. ask the player to propose action ..)
(cond
  [(a-failure-to-communicate? choice-failed) ...]
  [(take-action tree choice-failed)
  ; if the condition returns a truthy value, apply the following function:
   => (λ (next-tree) ... resume playing ..)]
  [else .. the player attempted to cheat ..])
The marked code is the only call to the game tree. The function returns an option, which in (Typed) Racket is represented as the union of #false and a game tree.

The game tree interface specifies this function approximately as follows:
(take-action
  ; if the tree maps the action to a tree, return it; otherwise #false
  (-> tree? turn-action/c (or/c #false tree?)))
The full specification depends on the choice of representing "skips".

Here is the relevant excerpt from the game state interface:
(place-avatar
 ; place avatar for specified player at given position in this state
 (-> state? posn/c state?))
 
(move-avatar
 ; the first player in this state moves an avatar from the old to the new
 ; & cash in fish on old tile
 (->i ([s state?] [old posn/c] [new posn/c]) [r state?]))
Note that neither contract checks whether there is already an avatar or whether it’s possible to move from one place to another. (The board does signal an exception if a penguin moves to a hole.) It is up to the rule checker to enforce these constraints.

Shortcomings You may argue that during the placement phase—or as our lectures call it, the system initialization phase—should be included in the rule book or should have a chapter of its own. That’s correct. We ignored this issue because (1) the enforcement is straightforward—there is a tile and there’s no penguin on the tile—and (2) it simplifies your implementation.

image

Thu, December 8, 2022 12:28:44 PM

Please take a look at a sample game state specification. Yours may differe and get full credit, but this one provodes full guidance and later explanation of the design rationale.

[My implementation deviates from this plan.]

image

Mon, November 28, 2022 2:53:03 PM

So no one had 4 — The Game Tree ready to present for class last week. While I will still adjust everyone’s grades accordingly, there was no sense in plowing the class forward when no group was able to keep up. So we said you all would have the additional week of Thanksgiving in order to catch up and to accomplish this task. I will expect you all to have your assignment harvested by our Tuesday evening deadline, and to be prepared to build on this assignment for next week.

Technical debt and software complexity both compound at a usurious rate!

image

Thu, November 24, 2022 11:24:35 AM

I understand after seeing the following press release from Microsoft that WSL is now generally available for Windows 10 and 11 users. This means that you, a student in 4117, should almost certainly and no matter your laptop now have access to a linux machine on your own system. This also means that you should expect to, in your future, be working with a unix-style system even if you plan to continue working in a Windows environment and even if you plan to move to Redmond, WA.

image

Wed, November 16, 2022 10:28:53 AM

Python is a different language that Java and C++, and your projects at your job will be different than the software built at some other company. Nevertheless, as software engineers you will find yourselves solving similar problems over again, or solving problems similar to those other designers have had to solve in the past. The term "design patterns" refers to a collection of common high-level program organization techniques to solve such common problems.

You will do well to recognize these situations when they arise, and to refer to these common best-practices. This will help you write better, cleaner software faster. This is also a common shorthand method of communication, and you must learn the lingua franca.

I have not exhaustively visited any of the following, but I did sift through some of the most prominent options and remove those that I thought did not match what you pythonistas need to know.

image

Tue, November 15, 2022 4:39:20 PM

Some students wrote that they would be able to greatly benefit from a slight extension on this assignment. Given that we have a slightly adjusted schedule next week because of the Thanksgiving break, I can make that happen for you. Here is the bargain you have struck.

image

Mon, November 14, 2022 6:00:29 PM

Some of you might be missing a good model for how to apply the design recipe in OO-style programming. Python does offer first-class functions and lambda. However, if the library you are having to use is implemented as an OO library, you will need to know how to write well-designed OO code using such a library. GUI components are a canonical use-case where an OO design makes sense. I suggest you skim over the draft of "How to Design Classes", specifically §16, on pg 173 (185 of the PDF).

image

Mon, November 14, 2022 1:30:50 PM

Warning: these are not exactly the rules by which we’re playing or the design of the game I’ve asked you to build. However you might find it’s fun to see roughly what a two-player version of the game is like. You can play this version of fish on desktop or in the browser. You might be surprised how tough it can be to beat a children’s game.

image

Sat, November 12, 2022 5:45:20 PM

A student asked for an explanation of the .PP naming convention. This has been clarified for you. In general, when you see purple or red-colored text in an assignment description, this will connote for you a clarification, change or correction to that portion of the description.

image

Mon, November 7, 2022 5:59:42 PM

Those of you who developed your application expecting tkinter may yet be in luck. If you do not depend on python 3.6 specifically, here is a way to get tkinter to work on sciris.

    [hemannja@sciris ~]$ python3.4

    Python 3.4.10 (default, Jun 23 2021, 22:06:51)

    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux

    Type "help", "copyright", "credits" or "license" for more information.

    >>> import tkinter as tk; window = tk.Tk()

You have your sysadmin to thank for this.

image

Sun, November 6, 2022 3:48:07 PM

Those of you who are still pursuing a GUI solution for python might consider using the PyQT library, since that comes installed on sciris with our version of python3. I have no experience using it besides the following, nor have I built the project using it in python, but this may be sufficient for your needs. I have gone as far as to try the basic example.

image

Sun, November 6, 2022 9:39:30 AM

A student writes with the following question.

[W]hen the assignment states to be able to "remove tiles", I am trying to understand what that means exactly. Before rendering the board, am I specifying the specific tile(s) I want to remove? Or, am I specifying an amount of tiles I want to remove (which can then be removed randomly).

You should implement some functionality to, given a board and a coordinate, return a board missing a tile at that coordinate. This is the general functionality you will want to have.

Once implemented, you could imagine using this functionality to do the following:
  • Produce an initial board with n tiles removed (by randomly selecting n distinct coordinates, building a full board, and removing those tiles in sequence.)

  • Build an initial board with a specific set of coordinates missing their tiles (by taking as input a missing-tiles-list, and building a full board then removing each of those tiles one after another).

These are of course only a couple of examples.

image

Wed, November 2, 2022 6:10:16 PM

A student pointed out on Monday that I had accidentally given you an extra six days for this first assignment. It was intended to be due on Nov 1, but due to my carelessness and inability to read my own writing (as well as to implement sufficient checks in my VCS) you all have until the 7th of November. Please make great use of that additional time.

image

Fri, October 21, 2022 4:54:33 PM

In my in-class presentation, I neglected to mention to you an additional facet of the overall system I envision. Both your architecture and your plan should accommodate this idea. As another way to make some money for our business, we will have our own "house AI" based players—AI players that *we* launch. (You can imagine how these players would be useful to fill out a tournament bracket, and also as an additional way to raise additional money for the business.)

image

Fri, October 21, 2022 11:53:22 AM

I know many of you are new to programming in a Unix environment. Some of you probably wanted to be directed to a more didactic resource with some expository background. If you are not already familiar with these systems—which is the vast majority of you all— you would do well to consult some of the following. A professor at Stevens just up the road has made available his course texts on Unix systems usage and administration. You are finding yourselves doing some of that. He has even built YouTube videos for the courses. You would do well to watch for some background.

image

Sat, October 15, 2022 5:54:19 PM

Recall that, in our in-class discussion of netcat and TCP communication, I had us look up our internal IP addresses. Please see E — TCP for the details of those communications, including the expected behavior for xtcp.

This post recapitulates some of what we saw in class w/tcp communication over netcat, and also explains why you might have some difficulties trying this at home. You should try this at home, and get it to work—this will be good practice for you.

On a computer with internal IP address 2.3.4.5, I typed the following:

    $ nc -l 3000

That commands tells this terminal session to start a program on this computer to listen for traffic on port 3000. You Windows people had to use Ncat.exe, I believe.

On another computer, I typed:

    $ printf "foobar" | nc 2.3.4.5 3000

This command sends the string "foobar" addressed to IP address 2.3.4.5, on port 3000.

Recall I said internal IP address. Internal, in contrast with external IP addresses. Your own home wireless network has your devices connected to it—phone, tablet, laptop, printer, etc. And those can directly see and talk with each other. But your friend’s computer isn’t on your local network—your friend’s computer is at his house, on his local wireless network. For that matter, Google’s web server isn’t at your house on your own wireless network.

Each of those networks—yours, your friend’s, and Google’s—has a router on it. When you try and communicate with Google or your friend’s computer, their router is where that information crosses over from outside the external network to inside the internal network. The router’s job is to send good traffic along to where it’s supposed to go inside that internal network, and filter out malicious or bad traffic. When your browser talks with Google, Google’s router sends that traffic to their web server along port 80. But Google’s router won’t do that with traffic intended for port 25. The router sends traffic on that port to a different machine, the email server. There are rules set up to tell the router which traffic to route where, based on the port it’s communicating on. And some traffic, on ports that aren’t open, won’t get routed on anywhere.

So, those of you who are listening for incoming TCP connections on your local home network may need to do some configuring of your router to make sure that your router knows to forward traffic on whatever port your partner is communicating to your machine.

image

Wed, October 12, 2022 7:43:28 PM

As per our in-class discussion, please notice that the due date for E — TCP has been extended to Tuesday. I cannot overemphasize how irregular this is. I have taken your suggestion, and will make assignments due on a Tuesday-Tuesday schedule, so that you have time to ask some questions in class. We discussed how to install netcat (aka ncat) on Windows, and then how to use that on Windows.

In class we left open a discussion of how to redirect IO in the standard Windows cmd shell. I link here to all the information you would require, and then some (follow the link labeled "Redirection").

image

Wed, October 5, 2022 8:39:12 PM

As per our in-class discussion, please notice that the due date for E — TCP has been extended two days, to give you the time after break to ask additional questions. You will see also that I have updated the assignment description (and added pictures more reflective of our local environment.)

image

Tue, October 4, 2022 9:26:27 AM

The transformation of textual information into internal data is known as parsing, a technical problem that spawned an entire research area. Parsing is so complex, it should never be used in an introductory course but to this day, many such courses assign programs that read text, analyze it, and react to it—without proper support. Proper coverage is offered in Compilers and Theory, and these two course will help you design parsing programs properly.

At first glance, JSON is a simple notation for writing down information in terms of Booleans, Strings, Numbers, arrays of JSON expressions, and objects of JSON expressions. But, as it turns out, turning JSON information into internal data is a minefield; indeed, no two JSON parsers seem to accept the same JSON inputs.

You should keep this fact in mind for your upcoming co-ops, internships, and future employment.

image

Tue, October 4, 2022 9:26:27 AM

You will notice that your next assignment is now out. You should get started on this immediately, as I expect it will take many of you more time than you anticipate to properly complete.

image

Fri, September 23, 2022 1:45:55 PM

You will notice that I have (in part retroactively) extended the due dates for xjson and xgui. In all, you will have had more than two weeks extension for an ~20 line program. We must do better than this.

image

Thu, September 22, 2022 9:55:29 AM

As you know, the grades for your first real homework has been released. Here are two critical comments:
  • our test harness does not run make unless there is a Makefile

  • an executable shell script must start with a #! because it won't run as a subprocess otherwise.

image

Thu, September 22, 2022 9:45:22 AM

This note specifically regards our discussion of ^D ("control D") from yesterday’s lecture, which transmits eof. If this is all new to you, I suggest you read this friendly article introducing these sequences.

A unix shell is incredibly powerful for such a small tool: it is effectively a little line-editor right there in the terminal.

The stty command lets you investigate and configure the behavior of your terminal. To learn about all the control sequences you have available, you can execute the same command as I do below:

    

    [hemannja@sciris ~]$ stty -a

    speed 9600 baud; rows 74; columns 255; line = 0;

    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

    -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts

    -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8

    opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

    isig icanon iexten echo echoe -echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

    

To learn more about what the stty command can do for you, of course, you should consult the manual.

image

Tue, September 20, 2022 9:12:14 PM

A student writes by email:

    How again do I XYZ?

    

    Finally, can you walk me through the full process of PQR and then ABC?

For what I deem straightforwardly technical questions, I am unlikely to give you satisfying answers to such questions. In general, I can likely tell you how to do all of these things. Easily and quickly. Either because I know from having already had to look it up and see, or because I can quickly do so. Instead, I want you (together with your partner) to go find out the answers, and resolve these issues yourselves.

I want you to practice this meta-skill of learning technical skills, and I want you to practice so that you can do it quickly. That is a more important than the solution to XYZ or the steps to PQR or ABC.

Your employer will not expect you to know the ins and outs of every foobar software product. Your employer should be able to expect you to pick it up on your own by reading, searching the internet, experimenting and debugging.

If you find yourself in this situation, you might start by typing into your search engine the question that you were going to ask your instructor, and then refine it from there. Of course, if you don’t know the right way to ask for help on the internet, ask the internet how to do so.

image

Wed, September 14, 2022 7:49:44 PM

You will notice that I have (in part retroactively) extended the due dates for xyes and xjson.

image

Mon, September 12, 2022 7:32:39 PM

Please notice that I added pages to the website discussing your lab books, as well as details on the roles for panelists and how I will assess your activity in each of those roles. You should find these on the lefthand side of the page.

image

Mon, September 12, 2022 5:45:55 PM

In class today we discussed possibly needing to set a local SSH key. You can, as we discussed use the GIT_SSH_COMMAND environment variable with your commands. This will become tiresome. In your repository’s .git directory you will find a config file. You can edit this file by hand to add the key core.sshCommand and the associated correct value. It’s probably safer to use the git config command (presumably with the --local flag if this is not your usual SSH key).

image

Fri, September 9, 2022 3:10:08 PM

FYI to the Pythonistas out there, sciris already has Python version 3.6.8 available to you, via the python3 command (this is a pretty common practice). However, I went ahead and build and installed Python 3.10.7 entirely in my own user-directory, without root privileges, if for no other reason than to show that you can do it too.

See?

image

Fri, September 9, 2022 2:46:02 PM Welcome to the Fall 2022 edition of Software Engineering I. As always, we aim to deliver a course that teaches you a lot, not in terms of industrial tools and techniques but for your life as a reflective software developer.

Please familiarize yourself with this web site, its organization and its content. The site will continue to grow:
  • this front page serves as a universal announcement scroll,

  • the Assignments, Actual page serves as your “task list,” and

  • a few other pages come online as needed.

image