259 Park Science Building
gtowell at brynmawr dot edu
|Lecture||1:10 - 2:30 MW||Park 180|
|Lab||11:40 - 1:00 Wed||Park 231|
|Office Hours|| Monday 10AM - Noon. Tuesday 1pm-2pm
Also by appointment
232 840 6920.
|Password: given in class|
An introduction to the study of programming languages. Where do programming languages come from and how do
they evolve? And why should a programmer choose one over another? This course explores these topics by
covering programming language features and paradigms, including object-oriented, functional, and imperative.
The course will focus on general structures common to programming languages; focusing on why those
structures exist, the various ways in which those structures are implemented, and how to use them.
In addition, the course will look at programming techniques in two, very different, languages: Go and Elixir.
|Computer Lab||Park 230 & 231||Instructions for using the lab
Remote accessible lab computer status
Programming Language Pragmatics
by M. Scott
Not required But I have found VERY useful
The Go Programming Language
by A. Donovan and B. Kernighan
Not required But I have found useful
Learn Functional Programming with Elixir
by U. Almeida
- Aug 29, First class
- Sep 28, first midterm
Note in 2022 we did not read "the semi-colon wars" so q1 does not apply.
questions from midterm1 of 2021
Answers for midterm1 of 2021
Answers for midterm1 of 2022 Note that these are student answers that got full marks (and were typed). This does not mean that the answers were perfect or even error free.
- Nov 9, Second Midterm Some practice questions for second midterm from 2021 (where you see "kotlin", read "Elixir")
The second midterm from 2021 This test focused on functional programming in Kotlin which is a very different language than Elixir. You should make the following adjustments to the numbered question.
- Answer for Elixir. After putting revising the statements to be syntactically correct
- Translate to Elixir and answer
- No adjustment
- skip entirely
- answer just for Go. Ignore Dijkstra.
- use Elixir
- use Elixir
Some sample questions. Note that these questions are of the form you might see on the final, but they are questions that I rejected from the final. (Where you see "kotlin", read "Elixir")
Final from last year The following translations should make the questions apply to this year
- Q3. rather than "mapIndexNotNull" in kotlin, write mapNotNull in Elixir.
- Q6. There is not good translation
- Q7. Substitute Go for Kotlin
- Q9. Substitute Elixir for Kotlin
- Q10. Just drop Kotlin; answer only for Java
All assignments must be turned in on time. If there are compelling reasons why you cannot turn in an assignment on time, you must ask for permission at least 48 hours in advance of the due date.
Despite my best efforts, homeworks may have sections that are not quite correct. If you find an error, let me know. If I agree that the issue is an issue and you have told me of the issue at least 48 hours prior to the due date then I will give bonus points as follows:
3 points for the first issue reported 2 points for the second issue reported 1 point for the third issue reportedOrdering is based on date of email receipt. One bonus per person per assignment.
All programming assignments must abide by the standards set forth here Design Principles Posted code samples will -- almost always -- adhere to these standards. To the extent the code samples do not, it will almost always be in the are of naming of variables. I can be lazy and I write a lot of code (most of which you do not see). (Code shown in class may not adhere to these principles, usually in the interest of brevity.)
All programming assignments must be accompanied by a README file. I will read, and often will respond, to all README text. See the file for a description of the expected contents.
- Homework 1 Due Sep 12, before 11:59:59pm
- Homework 2 Due Sep 26, before 11:59:59pm
- Homework 3 Due
Oct 24Oct 25, before 11:59:59pm
- Homework 4 Due Nov 17, before 11:59:59pm
- Homework 5 Due Dec 9, before 11:59:59pm
- Lab 1: August 31. Access and Login.
- Lab 2: Sep 7. factors from prime factors (and other things) in Java
- Lab 3: Sep 14. Go Practice
Go practice. These programs are NOT commented; which is fine for labs. Comments are required for homeworks.
- Lab 4: Sep 21 Sorting and implementing interfaces in Go
- Lab 5: Oct 5Go Packages For my program, I go the following results
UNIX% go run candy.go 100 The average of candy bought to collect all cards is 516 UNIX% go run candy.go 500 The average of candy bought to collect all cards is 3402 UNIX% time go run candy.go 35 The average of candy bought to collect all cards is 144 9.88s user 0.58s system 103% cpu 10.122 totalThe final run shows the CPU time taken my my program for 1 million trials of my program on my Mac
- Lab 6: Oct 19 Go and JSON
- Lab 7 and 8: Oct 26 and Nov 2 Elixir
- Lab 9: Nov 16 Elixir Enum and reduce
- Lab 10: Nov 30 Implementing a linked list in Elixir
My linked list solution for lab 10 is here. Note I played lots of coding games. In particular I used Elixir's version of the Java toString function.
This course is intended to be fairly free-flowing with a lot of discussion. Therefore, I will not normally publish powerpoint lecture notes. I will try to restrict my commentary to topics covered in the text.
- Aug 30: Introductory remarks.
- Aug 31: Scott 1.1-1.4
- Sep 7, Sep 12: Topic 3, Programming in Go
- rough notes
- rough notes with minor revisions and reordering after Sep 7 class
- Hello World
- ++ expression in Java
- NO ++ expression in Go
- command line args
- tuple assignment and functions
- functions, if, loops
- more with slices
- structs in Go
- structs, structs inside structs
- binding methods to structures
- timing go, implementing interfaces, sorting
- Definite assignment in Java
- arrays in Go
- Sep 14, Sep 19, Sep 21: Topic 4, Names, Scopes and Bindings. Ch 3 from Scott (not 3.4)
- Topic 5: Sep 27, Oct 4, Oct 6
Chapter 6 in Scott
- Topics 6 and 7:
Oct 17, 19, 24, 26
Functional Programming and Elixir
See Syllabus for readings
- rough notes
- Hello Worldsimple complex
- function and types in Elixir
- immutability and strings in Go
- immutability in Elixir with closures closure in Go parallel to Elixir example
- upper case using anon funcs and pipes upper case using named funcs (in a module) and pipes
- closures in Elixir closures in Go mostly parallel to tge ones in Elixir
- pattern matching in function params
- more function matching and recurrence in Elixir same things in Go (sort of)
- Tail recursion in Elixir
- Higher order functions in Elixir
- reading files and command line parameters
- Topic 8:
Oct 31, Nov 2
Types: Scott: Ch 7
- rough notes
- Go enumerated types
- Enums in Java
- type equivalence in Go
- type equivalence in Java
- equivalence in Elixir
- type casting in Go
- unsafe type casting is barely possible in Go
- Type inference in Go
- Generics can result in immutable data structures in Java
- Type Erasure in Java Generics
- Deep copying in Go
- deep copy in Java
- Topic 9:
Nov 7, 14
Composite Types: Scott Ch 8
- Topic 10:
Nov 16, Nov 21
Subroutines: Scott Ch 9
- rough notes
- Go: pointers
- Go: Building a linked list in Go
- Go: passing pointers
- Java: call by sharing (as discussed in class)
- Java: pass references
- Go: pass with closure
- Go: changing closure
- Go: variadic functions
- multiple return values in Go.
- Go: the defer command
- Go: Basic Exception handling
- Go: more exceptions
- Some simple events in Java
- Roll your own events and event handlers -- starting onto concurrency
- Object closures in java
- Topic 11: Not this year
- Topic 12:
Nov 28, 30, ect
Concurrency: Scott Ch 13:
skip: 13.1.2, 13.2.3 (except fork/join and Box 13.3) 13.3 except 13.3.5, 13.4.1, 13.4.2, 13.4.4, 13.4.5
- rough notes
- basic threads in java
- Go: basic threads
- Elixir: basic threads
- Java: threads and events
- Better threading in Java
- Go: limiting the number of running threads
- Elixir: limiting running threads
- Java Thread locking
- Java locks and atomics
- Go: atomics
- Go: getting CS machine listing
- Elixir: a simple web crawler with message passing
- atomicity violations and java synchronized
- Atomic counter -- improved -- in Go as discussed in class on 12/5
- limited threads in Go with tasks instructions in structs in a shared memory slice as discussed in class 12/5. Note that this arguably needs some work with atomics to make it a good solution
- message passing in elixir on the usual counter tasks.
Attendance and active participation are
expected in every class. Participation includes asking questions,
contributing answers, proposing ideas, and providing constructive
Please stay in touch with me, particularly if you feel stuck on a topic or assignment and can't figure out how to proceed. Often a quick e-mail, or face-to-face conference can reveal solutions to problems and generate renewed creative and scholarly energy. It is essential that you begin assignments early.
GradingGrades will be awarded based on the number of points earned and according to the percentage breakdowns shown.
Mid-terms will be take-home and intended to be completed in the time of a single class session. All exams will be open everything. The only restriction is that you may not discuss the exam, in any way, with anyone until 24 hours after the exam (unless you are told otherwise by me).
Incomplete grades will be given only for verifiable medical
illness or other such dire circumstances. Incomplete grades must be approved through the Dean's
ALL work submitted for grading should be entirely YOUR OWN (except for labs). Sharing of programs, code snippets, etc. is not permitted under ANY circumstances. That said, I encourage you to discuss assignments at an algorithmic level with other students. That is, talk about the problem, and general approaches to problems. Do not share or discuss actual code.
- Kernighan's book on programming style. Most of the examples in this book are in languages rarely if ever used, but the lessons still apply.
Learning AccommodationsStudents requesting accommodations in this course because of the impact of disability are encouraged to meet with me privately early in the semester with a verification letter. Students not yet approved to receive accommodations should also contact Deb Alder, Coordinator of Accessibility Services, at 610-526-7351 in Guild Hall, as soon as possible, to verify their eligibility for reasonable accommodations. Early contact will help avoid unnecessary inconvenience and delays.
This class may be recorded.
Creating a Welcoming EnvironmentAll members of the Instruction Staff are dedicated to the cause of improving diversity, equity, and inclusion in the field of computing, and to supporting the wellness and mental health of our students.
Diversity and InclusionIt is essential that all members of the course community – the instructor, TAs, and students – work together to create a supportive, inclusive environment that welcomes all students, regardless of their race, ethnicity, gender identity, sexuality, or socioeconomic status. All participants in this course deserve to and should expect to be treated with respect by other members of the community. Class meetings, lab sessions, office hours, and group working time should be spaces where everyone feels welcome and included. In order to foster a welcoming environment, students of this course are expected to: exercise consideration and respect in their speech and actions; attempt collaboration and consideration, including listening to opposing perspectives and authentically and respectfully raising concerns, before conflict; refrain from demeaning, discriminatory, or harassing behavior and speech.
WellnessAdditionally, your mental health and wellness are of utmost importance to the course Instruction Staff, if not the College as a whole. All members of the instruction staff will be happy to chat or just to listen if you need someone to talk to, even if it’s not specifically about this course. If you or someone you know is in distress and urgently needs to speak with someone, please do not hesitate to contact BMC Counseling Services: 610-526-7360 (610-526-7778 nights and weekends). If you are uncomfortable reaching out to Counseling Services, any member of the Instruction Staff will be happy to contact them on your behalf. We understand that student life can be extremely difficult, both mentally and emotionally. If you are living with mental health issues such as anxiety, depression, ADHD, or other conditions that may affect you this semester, you are encouraged to discuss these with the Instructor. Although the details are up to you to disclose, the Instruction Staff will do their best to support and accommodate you in order to ensure that you can succeed this course while staying healthy.
Created on June 2022. Subject to constant revision.