Intro to Modeling

Intro to Modeling

CS t-shirt

Most beginner programmers go from problem statement to keyboard entry immediately. In their first two years of programming, almost all of the programs they write are small, so the negative impact of this practice often remains hidden until they approach their first large project - either by themselves or as part of a larger team. In this Unit in the course, the goal is to learn to model a system and build a software architecture before starting to code. As the t-shirt, above, implies, proper planning can greatly reduce code size and overall project development time. While working through this Unit, here are the two main concepts you need to understand:

Fundamentals of Good Modeling and Architecture

  1. The View (the User Interface that the user sees) should be built separate from the internal Model that the computer sees. Almost always it makes sense for the data types used in the View (GUIs, virtual buttons, polygons with distinct colors, etc.) to be different from the data types used to construct the internal Model (integers, decimals, booleans, etc.) This is because the computer is more adept at manipulating numerical quantities than visual objects.

  2. There should be a layer in the software (which we will call the Controller) that will segregate the logic for the app. Other entities in the design should mostly interact with this layer instead of with each other. In the architecture portion of this Unit, we will introduce one such architectural concept called the Model-View-Controller (MVC).

The video, below, provides an introduction to the art and science of modeling a system in computer science. In the example given, a trinary (3-state) model is constructed for a simple tic-tac-toe game. It also describes how the external View differs from the internal Model.

Quiz on Modeling

1 point
You have 8 billiard balls, one of which weighs slightly more than the others. You also have a balance scale (a weight scale with two sides). How many weighings will it take for you to discover which ball weighs more than the others?

Project on Modeling

Do the Ants on a Log Project in the list of projects.