My Spring 2015 Schedule at Clark College

Here is my class schedule for the spring 2015 quarter:

Monday/Wednesday – JavaScript (CTEC 126) 2:00-4:20PM at CCW/WSU, room 104

Tuesday/Thursday – Intro to Programming and Problem Solving (CTEC 121) 10:00AM-12:20PM, room SHL 125
Tuesday/Thursday – PHP with SQL II (Advanced) 3:30-5:50pm, room SHL 124

Check the Clark College website to see when you can register.

Two Years as a College Professor

This month I completed my second year as a professor at Clark College. In that time I have taught HTML Fundamentals, JavaScript, Intro to Programming and Problem Solving with Python, PHP with SQL 1 and PHP with SQL 2. In that time I have taught 500 students, received the 2013 Exceptional Faculty Award and have made many new friends and colleagues. It seems like just yesterday that I was discussing the opportunity of teaching at Clark with MarkyMark, Matt and Ben. Thanks guys for your guidance and friendship.

My friends Ed and Volker call this my “encore career” and I couldn’t be happier and in a better place than where I am now.

Classes I am Teaching at Clark College this Fall

For the Fall Quarter I will be teaching the following courses at Clark College in Vancouver, Washington:

  1. CTEC 121 (class full): Intro to Programming and Problem Solving (Python) – 5 credits
  2. CTEC 122 (class full): HTML Fundamentals (HTML/HTML5/CSS) – 4 credits
  3. CTEC 122 (seats available): HTML Fundamentals. This class will be for the Vancouver Public Schools iTech Program at Washington State University (HTML/HTML5/CSS) – 4 credits
  4.  CTEC 126 (seats available): JavaScript – 5 credits

If you are interested in taking any of these classes please let me know.

MongoDB and Python: A Simple Example

The code below demonstrates how to use Python to connect to a MongoDB database. I chose to use a cloud based instance of MongoDB provided free of charge by The script demonstrates how to:

  • Use the PyMongo library to connect to a Mongo database
  • Insert documents into a collection
  • Display all of the documents from the collection

I also used a local instance of MongoDB for testing. You will will need to use a Python package manager such as EasyInstall to install the PyMongo library.

Here is the Python code:

# Author: Bruce Elgort
# Date: March 18, 2014
# Purpose: To demonstrate how to use Python to
# 1) Connect to a MongoDB document collection
# 2) Insert a document
# 3) Display all of the documents in a collection</code>

from pymongo import MongoClient

# connect to the MongoDB on MongoLab
# to learn more about MongoLab visit
# replace the "" in the line below with your MongoLab connection string
# you can also use a local MongoDB instance
connection = MongoClient("yourmongodbconnectionstring")

# connect to the students database and the ctec121 collection
db = connection.students.ctec121

# create a dictionary to hold student documents

# create dictionary
student_record = {}

# set flag variable
flag = True

# loop for data input
while (flag):
   # ask for input
   student_name,student_grade = input("Enter student name and grade: ").split(',')
   # place values in dictionary
   student_record = {'name':student_name,'grade':student_grade}
   # insert the record
   # should we continue?
   flag = input('Enter another record? ')
   if (flag[0].upper() == 'N'):
      flag = False

# find all documents
results = db.find()


# display documents from collection
for record in results:
# print out the document
print(record['name'] + ',',record['grade'])


# close the connection to MongoDB

If you have any questions please let me know.

Don’t Distract New Programmers with OOP

Thomas Gumz sent me a link to a blog entry entitled “Don’t Distract New Programmers with OOP“. Having just wrapped up one year of teaching “Intro to Programming and Problem Solving” to students at Clark College, I could not agree more. One of the core outcomes of my class is centered around functional decomposition – how to break down a problem into smaller, simpler parts.

When I get asked “What’s a good first programming language to teach my [son / daughter / other-person-with-no-programming-experience]?” my answer has been the same for the last 5+ years: Python.

I get this same question almost on a daily basis from so many people. Admittedly, before I started teaching the class I questioned the use of Python for new programmers. Well, guess what? It’s the perfect language and I have the results to prove it.

Did we cover object oriented programming in the class – yes, but not to the level that most would expect. We did just enough for students to wrap their heads around the concept. In fact, one student tried to use OOP for their final project and had a heck of a time. In fact this student was pushing for more OOP content and after the class concluded they admitted that OOP was much harder then they expected it to be.

The shift from procedural to OO brings with it a shift from thinking about problems and solutions to thinking about architecture. That’s easy to see just by comparing a procedural Python program with an object-oriented one. The latter is almost always longer, full of extra interface and indentation and annotations. The temptation is to start moving trivial bits of code into classes and adding all these little methods and anticipating methods that aren’t needed yet but might be someday.

Be sure and read the blog entry as I think that you will agree with avoiding OOP in an introductory programming class. If you are interested in learning more about pursuing a programming career drop me an email as I would love to help.

You can read what others are saying about this article on Yacker News.

More >

Learning How to Code with Bruce: The Results

For the past year, I have been teaching a course at Clark College in Vancouver, Washington called “Intro to Programming and Problem Solving (CTEC 121)”. During this time 60 students have successfully completed the course. Here is the class description from the course catalog:

Fundamental concepts related to designing and writing computer programs and procedures. Topics covered include: problem-solving techniques, program design, coding, debugging, testing and documentation. The course stresses concepts common to all programming. Prerequisite: Eligibility for ENGL& 101 and a grade of “C” or better in MATH 095. CTEC 120 recommended.

Typically, 95% of the students who take this class have had no prior experience with programming. In fact, it may even be higher than this.

RECAP: Students in CTEC 121 have never ever written a single line of code.

One other important to thing to mention is that 80% of the students who enroll in this class are not enrolled in a development focussed degree program. Most are from networking, business and other disciplines. Fascinating eh? Read on…

For the Fall quarter I decided to not give a final exam but rather a final practical project. Students were required to build a full-fledged application using the Python programing language. The project requirements included:

  • Demonstrate use of all elements of the structure theorem (sequence, selection and repitition)
  • Use on or more Python libraries
  • Demonstrate the ability to read/write files
  • and many other requirements…

On Monday the class presented their projects to the class and frankly, the students and I were totally blown away by their projects. Remember, these students have only studied programming in the CTEC 121 class for 9 weeks prior to creating their final projects. I wish you all could have seen the students faces when they saw demonstrations presented by the others.

To give you an idea of the types of projects submitted here is a list of some of the apps students created:

  • An app that helps racing pit crews with calculating critical data needed for fueling, tire replacements and more
  • An app that uses the Wikipedia API to read and display random Wikipedia entries using JSON and REST services.
  • A math quiz app
  • A complete graphical version of the game Battleship
  • Several role playing games both text and based and graphics based
  • The game Othello done with the Python library
  • A flash card creation and presentation app
  • Several awesome versions of Tic-Tac-Toe
  • An image processing app just like Instagram (complete with an MSI installer)
  • and many others

Congratulations to all of the CTEC 121 students on creating such awesome final projects. You made this instructor very proud.