Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Conceptual Models of a Program? 411

retsofaj queries: "Almost all of the introductory programming books I've looked at focus on syntax, with possible digressions into a bit of semantics. What I haven't found are any great discussions that go beyond syntax and semantics and make it all the way to conceptual models. My goal is to develop a set of resources that can be used in an introductory course that teaches students programming starting with conceptual models, as opposed to starting with syntax."

"What I mean by conceptual models are how you think about what a program is (if a program can be anything!). Examples would be (all prefaced by "a program is made up of..."):

  • flowcharts (structured programming)
  • arrangements of opaque things sending messages to each other (OO)
  • transformations of data structures (Wirth's view)
  • state machines
  • a knowledgebase (Prolog, etc.)
  • algebraic operations on sets (Functional languages)
Of course this is just the list I've come up with off the top of me head. My questions for the community are therefore:
  1. Who/Where/How are the different models of a program being taught?
  2. What conceptual models do you use when programming (and where would I go to find out about them)?
I acknowledge that some of these are covered by UML, but UML seems biased towards the object model of a program, which seems to exclude things like knowledgebases and functional approaches."
This discussion has been archived. No new comments can be posted.

Conceptual Models of a Program?

Comments Filter:
  • Experience!!! (Score:2, Redundant)

    Experience is the only way to learn... write a program and its shitty, rewrite it and its less shitty... rewrite it again. Learn from your mistakes. You can't learn to program without practice. bling bling!!!
    • Re:Experience!!! (Score:3, Insightful)

      by DrSkwid ( 118965 )
      sorry but experience alone will not teach one the breadth of the subject. How, for instance, will one deduce that the re-written program would be better suited to a different programming paradigm if one has not studied the known paradigms?

      Without reading about say, Functional Programming, how will one make the intuitive leap mearly by exercising the iterative.

      Like *all* disciplines it is the combination of study and practice that will lead the way.

      • The grand-parent has a point, experience is the most valuable asset in any project. Regardless of choice of language, understading of the problem domain, or design paradigm, the knowlegde that certain approaches just wont work well is invaliable. Of course, finding the one that works the best, is a different question, but there again, experience will often lead to the more correct answer.
  • Analysis/Design? (Score:4, Insightful)

    by Xtifr ( 1323 ) on Monday June 03, 2002 @06:48PM (#3634753) Homepage
    Perhaps you're looking in the wrong places? Introductory books on analysis and design would seem to me a better place to find an introduction to analysis and design than books on programming.

    Programming (coding) is how you implement a design. By the time you get around to coding, I would hope that you already have the design worked out.

    Or am I missing something here?
    • by burnitall ( 101330 )
      you're not missing anything, it's just that by and large design is done very quickly, usually on a white board, and almost always fails in some substantial way to fulfill the requirements.

      • Re:Analysis/Design? (Score:4, Interesting)

        by Xtifr ( 1323 ) on Monday June 03, 2002 @07:02PM (#3634868) Homepage
        Heh, well, yes, far too many real-world projects are started without enough analysis or design. No arguments there. :)

        But it sounds like this question was posed by someone who has recently discovered that analysis and design are important, and doesn't understand why programming books don't cover analysis and design in greater detail. Which is, to some extent, a bit like asking why books on carpentry don't teach architectural design.
  • Teach them flowcharting and logic structures, i.e., sequential, conditional, looping, etc... They will be able to program in any language then... it's really easy to transition.
  • by Anonymous Coward
    Make then learn LOGO.

    If a turtle walking around the screen can't teach the fundamentals of programming, nothing can.
  • Design Patterns (Score:4, Informative)

    by abroadst ( 541007 ) on Monday June 03, 2002 @06:49PM (#3634763)
    I think a good text for a course on conceptual models for software is Design Patterns by Gamma, Helm, Johnson, and Vlissides. When I first came upon this book it really opened my eyes. Now I can hardly imagine trying to be a software developer without the perspective offered in these pages.
    • Re:Design Patterns (Score:2, Insightful)

      by Shamanin ( 561998 )
      This is way beyond what an introductory course should takle. Design Patterns must first be recognized through sweat & tears before they can be truly understood and appreciated. Design Patterns offer the experienced software designer a common language to communicate their ideas to their peers.
    • by MillionthMonkey ( 240664 ) on Monday June 03, 2002 @11:12PM (#3636102)
      Of course those GoF patterns can make life hell for the maintenance developer or app framework user, when people turn it into a contest to see how many design patterns they can fit into a single project. The overall "Design Patterns" philosophy is really "how can I defer as many decisions as possible from compile time to run time?" This makes the code very flexible, but the flexibility is wasted when a consultant writes code using lots of patterns to puff up his ego and then leaves without leaving adequate comments or documentation. Without insight into how the system works, the configurability and flexibility that these patterns offer is lost. The system hardens into an opaque black box.
      Deferring decisions to runtime makes code hard to read. Inheritance trees can get fairly deep, work is delegated off in clever but unintuitive ways to weird generic objects, and finding the code you're looking for is impossible, because when you're looking for the place where stuff actually happens, you eventually come across a polymorphic wonder like

      object.work();

      and the trail ends there. Simply reading the code doesn't tell you what it does; the subtype of object isn't determined until runtime. You basically need a debugger.

      You can take a really simple program and screw it up with aggressive elegance like this. Here is Hello World in Java:

      public class HelloWorld {
      public static void main(String[] args) {
      System.out.println("Hello, world!");
      }
      }


      But this isn't elegant enough. What if we want to print some other string? Or what if we want to do something else with the string, like draw "Hello World" on a canvas in Times Roman? We'd have to recompile. By fanatically applying patterns, we can defer to runtime all the decisions that we don't want to make at runtime, and impress later consultants with all the patterns we managed to cram into our code:


      public interface MessageStrategy {
      public void sendMessage();
      }

      public abstract class AbstractStrategyFactory {
      public abstract MessageStrategy createStrategy(MessageBody mb);
      }

      public class MessageBody {
      Object payload;
      public Object getPayload() {
      return payload;
      }
      public void configure(Object obj) {
      payload = obj;
      }
      public void send(MessageStrategy ms) {
      ms.sendMessage();
      }
      }

      public class DefaultFactory extends AbstractStrategyFactory {
      private DefaultFactory() {;}
      static DefaultFactory instance;
      public static AbstractStrategyFactory getInstance() {
      if (instance==null) instance = new DefaultFactory();
      return instance;
      }

      public MessageStrategy createStrategy(final MessageBody mb) {
      return new MessageStrategy() {
      MessageBody body = mb;
      public void sendMessage() {
      Object obj = body.getPayload();
      System.out.println((String)obj);
      }
      };
      }
      }

      public class HelloWorld {
      public static void main(String[] args) {
      MessageBody mb = new MessageBody();
      mb.configure("Hello World!");
      AbstractStrategyFactory asf = DefaultFactory.getInstance();
      MessageStrategy strategy = asf.createStrategy(mb);
      mb.send(strategy);
      }
      }


      Look at the clean separation of data and logic. By overapplying patterns, I can build my reputation as a fiendishly clever coder, and force clients to hire me back since nobody else knows what all this elegant crap does. Of course, if the specifications were to change, the HelloWorld class itself would require recompilation. But not if we are even more clever and use XML to get our data and to encode the actual implementation of what is to be done with it. XML may not always be a good idea for every project, but everyone agrees that it's definitely cool and and should be used wherever possible to create elegant configuration nightmares.

      • Re:Design Patterns (Score:3, Interesting)

        by JamieF ( 16832 )
        Bravo! Fad coding is a very real problem, and in the OO world, over-abstracting and over-design-pattern-ing is a real problem, even though those aren't real words. :)

        There are requirements that can make abstracted designs a good idea - things like i18n, which suggests that all the text in your UI should be ripped out of constants and put in config files. So in that case Hello World would need a way to read the config file in order to easily morph into Bonjour Monde or Hola Mundo or whatever.

        I can't tell you how many times I've seen an object model in a project that starts with EVERYTHING being based on some GenericItem object that all the others inherit from, and GenericItem has no real value. The designer just wanted to use inheritance a lot. Oy.

        I like OO and all, I just don't like OO developers who read 10 books on OO and try and apply 100% of what they've read in their first project... and spend all their time building more and more goofy infrastructure instead of actually implementing any functionality.

      • The second HelloWorld program looks like a tracing question off of one of my CompSci exams :)
      • Amen to that ... (Score:3, Interesting)

        by Evil Pete ( 73279 )
        He he he. Yeah I've been guilty of that too after I first came across patterns. But not for long having once had to wade through layers of inheritance. I still love patterns but Pattern Paralysis is a real danger for new projects these days. It can be a real liability if a System Architect decides to go down the path of aggressive application of patterns. Trouble is , so much of the abstraction is totally unnecessary , programmers being so smart that they practically obfuscate the code with "good" design.
      • Re:Design Patterns (Score:4, Insightful)

        by spongman ( 182339 ) on Tuesday June 04, 2002 @03:10AM (#3636827)
        yeah, you have a point - don't try to write a class library when all you mean to do is write a program.

        but on the other hand most tasks aren't as simple or well defined as 'Hello World'. remember the last time your boss/client said "hey can we change it to do [this]" and you groaned because [this] wasn't anywhere near the original spec and you knew how much work it would need to hack it in? at that point you're wishing you'd abstracted just a little bit more at the outset.

        My corollary: the boss is always going to ask for something that you didn't expect. twice.

  • most people who can program already, did it the hard way by just simply diving in and doing it until it works. So it's very hard for people like that to go back and say what would to have worked better since they had to figure it out by themselves.

    Programming is a process and modern US school don't teach processes at all. They teach you what 2+2 is, not how to add numbers. If someone figures out how to add on their own it's not cause they were taught it in school. How many people can add up all the numbers from 1 to a hundred quickly?

    but not to make this a pessimistic post, I would say that teaching others how to program is probably best started with a flowchart type modeling, since that is easy to understand and can be represented graphically and then easily turned into code.
    State diagrams are harder to understand at first, but once you get them they are very good tools for writing programs.
    • > How many people can add up all the numbers from 1 to a hundred quickly?

      I can...

      $ perl -e 'foreach $i (1..100) { $sum += $i; }; print $sum . "\n";'
      5050

      Probably should have done this recursively for brain calisthenics, though ;-)

  • Sortof like a modern, complex Karel [mtsu.edu] in other words ;)
  • Worm's eye view (Score:2, Insightful)

    by Inthewire ( 521207 )
    I started programming because I had a problem to solve. I focused on what I wanted to accomplish, not syntax or method or anything else. That isn't to say I didn't think about things like modularity, clarity, documentation, testing, etc - I did. I read a lot of the common texts - Brooks' _Mythical Man Month_, McConnell's _Code Complete_, Raskin's _The Humane Interface_, Spolsky's website, and a host of articles. I didn't start out with a language in mind. I started out with a result in mind. All of those things helped me to understand that my program existed to solve a problem. It wasn't there to keep me busy. I wasn't writing it because I wanted to use every neat trick I'd ever heard of. I was trying to make my life, and the lives of those around me, easier. I don't know how well I accomplished that, but I did build a program that did what it was supposed to do.
  • A Famous One Is... (Score:5, Informative)

    by the eric conspiracy ( 20178 ) on Monday June 03, 2002 @06:52PM (#3634789)
    Structure and Interpretation of Computer Programs
    by Harold Abelson, Gerald Jay Sussman, Julie Sussman.

    • by CMonk ( 20789 )
      I'll second this one. Stop looking at programming books, if you want to learn Computer Science read Computer Science books. SICP is where I learned it all (in school).
    • by William Tanksley ( 1752 ) on Monday June 03, 2002 @07:06PM (#3634898)
      Agreed. This one's _essential_. In fact, I would go so far as to say I've seen no other choice; if you want to learn both how to program and how to think about programming, this is the only book which combines both.

      The only problem, as I point out in another message, is that they almost totally ignore other conceptual models of programming; lambda calculus is thoroughly explored, but combinatorial logic and similar models, as demonstrated impurely by APL/J/K and purely by Forth/Postscript/Joy, are almost ignored. A good teacher would, IMO, base a class on SICP, but augment with two of the above languages and a discussion of their paradigms.

      -Billy
    • I found this book online here [mit.edu] if anyone is looking for it.
    • Another option (Score:5, Informative)

      by jabbo ( 860 ) <jabbo@yahoo. c o m> on Monday June 03, 2002 @07:22PM (#3635006)
      I feel like Paul Graham [paulgraham.com]'s "ANSI Common Lisp" is more fun to work through (and makes my brain hurt somewhat less) than SICP. SICP is a really stiff book -- using that text for a class is a sure way to weed most people out. Graham's book, while very very intelligent and deep, is also a lot easier to grasp in many respects. Not a bad choice for 'SICP Lite' although that doesn't give it enough credit for what it teaches you about programming in the real world (vs. the computer-linguistics and mental gymnastics that SICP teaches you).

      (Read the articles on Graham's site. They're friggin' amazing distillations of experience. If you've been programming (successfully) for long enough, you'll not only be pleasantly surprised, but will find yourself nodding in agreement whilst learning about new topics. Anyways, the book is an implementation of much of what he writes about, into his 'Mother Tongue' of Common Lisp. Hell, this is one of the few good writers who can correctly answer the question:

      "If you're so damn smart, why aren't you rich?"

      The answer, for anyone whose opinions you'd want to trust, is "I am", and it's BECAUSE of his opinions. :-))
    • SICP is fantastic, but tough going for many. Here's one that's being used even at the high school level [teach-scheme.org], with some success: How To Design Programs [htdp.org] (HTDP).
  • Well ... (Score:2, Interesting)

    by Anonymous Coward
    ... maybe I'm just a bitter old bastard (ah, you kids, with your IDEs and source-code control! You don't *know* how good you have it!), but it seems that too many comp-sci programs, to say nothing of the autodiadacts who start out on the "24 hours to a six-figure-salary developing Unix device drivers" books, ignore the fundamental abstractions that underlie all computing.

    That having been said, it's not too hard to find good texts that cover these issues. Knuth's opus is only one example; there are several good books on algorithm design and analysis that are recent enough not to suffer from the "provably correct" disease of the '70s and '80s, and there's probably dozens of books by now that are part of the Booch series on OO design. Plus the hundreds of excellent texts on linear algebra and other basics.

    Is it necessary to *start* with these? Well, I'm a fan of a two-track system where students are given both theory and praxis, allowing them to apply the former by way of the latter. You can learn theory without application, but chances are you'll end up with something like Python (/me ducks and covers); you can also learn application without theory, but then you get ... well, most Microsoft products, for example.

    Just US$0.02 from The Watchful Babbler.
    • I said the same but not as well.

      I would add that this approach of theory w/out specifics of implemenatation is not as workable on a practical level.

      People learning to code want to get in their and 'do' something. They want to see some results and I don't think there is anything wrong w/that. You need to give them that opportunity to keep enthusiasm.

      The 2 track idea is excellent.

      .
  • In the Java "community", design patters are very popular as building blocks to build functional programs. There are many books available the the subject. One good one is EJB Design Patterns: Advanced Patterns,... [amazon.com], written by one of the guys who runs The ServerSide.com [theserverside.com] which also has a less formal discussion forum centering around design patterns.

    While many design patterns are specific to good J2EE design, and may not be relevant for all types of application, many are general enough to be used in any object oriented language. May be part of what you are looking for.

    -Pete
    (yes, the book link has my amazon id in it...click and buy the book. It's worth having.)
  • by jrstewart ( 46866 ) on Monday June 03, 2002 @06:55PM (#3634814) Homepage
    You may be looking for the book How To Design Programs [htdp.org]. I haven't read (all) of this book but I've learned a lot from the guys who wrote it. The complete text is online so take a look.
    • by jabbo ( 860 )
      kind of like 'SICP for nonprogrammers' (\me ducks).

      I liked the chapter differentiating generative recursion from structural recursion. That's a really insightful distinction in terms of the mechanics of grasping a problem and a good solution for the problem.

      Definitely worth a read, although I think SICP is the cleverest (most intellectually satisfying) exposition of these little gems ever written.

      I am reading (and doing) Paul Graham's 'ANSI Common Lisp' book for amusement and it's really sharpened my thinking. Macros are a great example of meta-generative-recursion, if you can call it that. Whatever you call it, it's raw power.

  • by stoolpigeon ( 454276 ) <bittercode@gmail> on Monday June 03, 2002 @06:56PM (#3634816) Homepage Journal
    The best way to learn programming is to do it. The more the better. And see what works and what doesn't.

    You have to know syntax and semantics to practice.

    To take the high road right off the bat is good conceptually but the problem is implementation is often where it gets difficult. I know a lot of people will disagree but I can tell you that the concepts behind something do not have a lot of value until the user has a level of experience that brings out that value.

    I believe this is true across a wide range of disciplines - not just programming. If you tell someone that breaking in boots is important to hiking (w/out getting into a lot of messy details) they may listen they may not. If they sit at the end of a trail w/blisters all over their feet (or see a companion in that shape) they will value the information much, much more.

    I've never found a conceptual approach to be nearly as useful before I've tried something compared to after those attempts.

    .
    • ...and read code! (Score:3, Insightful)

      by AT ( 21754 )
      I agree, but also read code. There are lots of large projects with source available out there; grab it and find out how their authors did it, and note whether the approach is understandable, consistent, scaled well, etc. You can only write so much code for the sake of learning; also some designs lend themselves to larger projects, beyond the scope of a learning exercise.

      Case studies are widely used in other disciplines like engineering, and they can be useful in programming too.
    • I find it frustrating to see people like the original submitter trying to do something like this. It is a fine example of someone with lofty ideals and noble intentions who is determined to not let reality get in the way of how things *should* be. Because if we can just teach them the wisdom *first* we can save them the time and effort of having to achieve it themselves! As the parent of this post points out, it doesn't really work like that. It would be really nice if you could teach most people the abstract theory and concept behind good design and development practices, but the truth is that you really appreciate why something is right by having done, or seen it done, wrong yourself.

      If you have never developed before, the conceptual underpinnings will be largely meaningless. Sure, students can and will learn what you're teaching by wrote, but the information is not *real* to them yet because they can't make the connection to anything within their experience. Further, they won't retain it long enough for it to be of value later when their development skills catch up enough to appreciate it. So it is all well and good to say 'teach the abstract stuff first' but you're just going to frustrate them and yourself. It's like trying to give the benefit of your life experience to a teen by lecturing them. It's just words to them until they come into that wisdom on their own someday and finally 'get' what you were trying to tell them.
      • You are discussing the difference between maths, engineering and social science. Programming can unfortunately only be described as a social science subject.

        In maths you are presented with the result (the theory), and then with the proof. You don't need to satisfy yourself that it is correct emperically or "in the real world" or that its better to do it that way. Its proven.

        In engineering you are presented with the result. You don't care about the proof, because you know that there is research and proof underlying the result, and you use the result in the recommended way to achieve those ends.

        In social science everyone has their own theory. Some people rise to the top of the pile, and get continually picked on. Occasionally someone provides sufficient emperical evidence to justify the result being called a fact within the subject's domain.

        This is the case with subjects like psychology and computer science. There is always more than one way to do or interpret something, and ego dictates that you must contest "accepted facts", and either derive or disprove the result for yourself.

        Programming SHOULD be taught as an engineering subject. There is a body of knowledge for programming according to the conceptual model in use, and it is based on hard evidence from decades of development.

        Unfortunately, software engineers prefer to make their own cement rather than ask the expert cement maker for the properties of the cement that is readily available.

  • Models (Score:3, Funny)

    by Guitarzan ( 57028 ) on Monday June 03, 2002 @06:56PM (#3634817)
    Make sure they're not those terribly thin, Kate Moss-like models. Give them at least a little bit of figure, please!
  • by Daniel Dvorkin ( 106857 ) on Monday June 03, 2002 @06:57PM (#3634831) Homepage Journal
    ... before you can tackle algebra.

    Students need to learn syntax before they learn (much) in the way of structure. It doesn't matter what language they first learn in, though I think something in the C family (i.e., C, C++, Java, etc.) is a good place to start, since a) most real-worl programming is done in one of these languages and b) if you can really, truly learn C, you can learn anything. ;)

    But hell, teach 'em in Perl or LISP or Pascal if it makes you happy. The point is that programming courses have traditionally started out with "Hello World" or some such thing for a reason: beginning computer scientists need to learn that they can type in, compile, and run a program before they start worrying about higher-level structures. Any attempt to teach theory before practice will fail as surely as the "New Math" -- which basically did try to teach algebra before arithmetic -- did a couple of decades ago.
    • While that's true, a lot can be done with beginners in a pseudocode type of "language" that does not actually get run. I recall my first "programming" exposure was BASIC in 7th grade math. We had no computers, and this was shortly before the Apple ][ came out. We wrote very short programs on paper which were then essentially traced by hand by the teacher.

      Still, as a beginner with zero exposure to programming at the time, I learned a lot: linear processing of commands, simple loops, printing, and yes, even some syntax such as line numbers and labels.

      (back to my point) Pseudocode can help teach the logic and flow and structure aspects of programming without the burden of having to follow syntactical rules at the same time. So, the first step should be to write out the "program" in a lightly structured pseudocode; the second step would be to "compile" that by hand into actual code when syntax had been covered. At that point, the fundamentals of the logic are out of the way and the students can focus on getting the syntax right.

      When I think about how my projects have been completed in the real world recently, this is essentially the same process I go through: map out the general logic (either in prose or with a type of pseudocode shorthand) and then program the thing after I've got that worked out.

      • Your comments about pseudo code are spot-on.

        However, that pseudo code can actually be run if it's done in Python [python.org]. Python is often described as "executable pseudo code". The syntax is very clear and very simple, but it is also amazingly powerful. Check it.
    • Learning C is very easy, it's a simple language. Learning to do something useful in C is the difficult part. :)

      • Mwahaha, couldn't agree more. I'm still a rather inexperienced programmer and while I've dabbled in various languages, C is definitely the one that makes me shudder. They present it to you easily enough... at first. Ya know: These are variables, this is an array, these are for loops. And then all of the sudden its "Oh my god, how do I use pointers! How to define a structure?! HOLY SHIT, IF THIS 5-LINE FUNCTION SEGFAULTS ONE MORE TIME I'M GOING TO MURDER THE ENTIRE PLANET!!"

        I'm sure we've all been there.

  • If this is a truly introductory class, please do what my first programming teacher didn't do: take a few classes to explain what the hell "programming" is. I went through a lot of confusion making the connection between words written into a file and behavior later when executing that file. Granted, this was a long time ago, and I had never sat behind a computer until my first lab in that class, but I imagine this is still a problem for most first timers.

    In my case, I was able to fall back on my considerable experience with logic concepts and advanced mathematics. Fortunately for me, Fortran behaved(s) itself in this regard and allowed me to apply these concepts. I learned that this text needed to be processed before running it, but I had no idea until I started studying C what the hell those steps really meant.

    Students today already have a bunch of assumptions of what computers are/do, so I imagine you'll have to help them unlearn some of that limited perspective. They also probably haven't learned a great deal of formal logic, so they might need some instruction there as well.

  • by vkg ( 158234 ) on Monday June 03, 2002 @06:59PM (#3634841) Homepage
    Although there are a lot of useful models like the ones you outlined, I'm not sure that there is any way to teach problem solving, and it's most important step, problem conceptualization.

    I think you could take people through graded series of exercises soluble in different approaches, but there's no "one size fits all" way to develop intuition.

    One approach used widely in architecture, a sibling profession if we ever had one, is "masterworks" - taking students through the works of other great architects, examining each decision made in some detail with reference to notebooks and discussions.

    I think that this approach may make a lot more sense than teaching theory because it gives some access to an experienced mind, rather than just a methodology created by such a mind.

    I know that I learned more from working with great programmers and absorbing their tricks than from any book I ever read or course I took.
  • flowcharts (Score:2, Interesting)

    by deanj ( 519759 )
    Uh...I'd toss the flowcharts...we tossed those back when I started programming more than 20 years ago.
  • by Bouncings ( 55215 ) <ken&kenkinder,com> on Monday June 03, 2002 @07:01PM (#3634858) Homepage
    What you are talking about is software design patterns. I suggest Eddison Wesley's book on the topic [barnesandnoble.com] of object orientation. There's less information on structured programming out there becuase structured programming isn't very trendy right now. New materials on cutting edge (yes, cutting edge) structured programming methodology is really only available on usenet and in people's code. For that, you are on your own.

    I also would advocate you not to follow the dogma that object orientation is the holy grail of software. Be open minded to structured programming too! :)

    • Nonsense. This book has nothing to do with IT fundamentals, OO or otherwise. As many [norvig.com] people [mit.edu] have pointed out, at best it can be regarded as a roll-your-own appendage to cover the flaws of current mainstream languages. This situation does not apply in academia - they can use any language they like.
      • > As many people have pointed out, at best it can be regarded as a roll-your-own appendage to cover the flaws of current mainstream languages.

        I just went and looked at both of those sites and I don't think that either are portraying design patterns nearly as harshly as you say they are.

        Here is a quote from the second link: "Some of the patterns disappear -- that is, they are supported directly by language features, some patterns are simpler or have a different focus, and some are essentially unchanged."

        From the first, "16 out of 23 patterns have qualitatively simpler implementations in lisp or Dylan than C++ for at least some uses of these patterns".

        Both of these are quite balanced evenhanded statements, neither condemning design patterns or equating them with language flaws. Both links are oriented towards only one difference between language kinds, dynamic rather than static. There are quite satisfactory reasons to choose static languages over dynamic ones regardless of whether the design patterns are more complex, and it is somewhat closeminded to call either approach flawed.
        • The quotes were just accessible examples of why this book is inappropriate as an introduction to conceptual computing fundamentals. There are other papers highlighting problems with the GoF book in its own terms, if that's what you're interested in. LISP and Dylan aren't perfect models either, and I certainly wouldn't base a course entirely on them.

          I'm sure you are aware of established books on computing fundamentals, such as How to Design Programs [htdp.org], so it must be fairly obvious that the GoF is not remotely comparable to these.
  • by William Tanksley ( 1752 ) on Monday June 03, 2002 @07:02PM (#3634865)
    The granddaddy of this type has to be MIT Press' SICP. It's a programming intro, but it teaches you lambda calculus as well as the problems with lambda calculus.

    Lambda isn't everything, and a good teacher should also cover some languages which use it lightly (J and K) as well as a language which doesn't use it at all (Forth, Postscript, Joy) -- but it's good to have as a starter. SICP doesn't teach 'conceptual models', though; I don't think that the authors even realised there were other conceptual models out there. Most people don't, since most people don't even know that lambda calculus has almost nothing to do with how computers work, but is rather just the way most programming languages have been designed, in imitation of Fortran.

    But I can't slam SICP. It may not cover other conceptual models, but it does a BANG-up job of covering the one it acknowledges, and even points out the weaknesses.

    -Billy
    • SICP [mit.edu] is it. It's more than just "a book about Scheme"! It talks about:
      • Scheme
      • Programming:
        • Recursion and iteration
        • Continuation
        • Debugging!
        • Types and type hierarchies
        • Infinite data types!
        • ...
      • Time complexity
      • Abstract models of computing
      • Functional programming
      • Object-oriented programming
      • Logic programming
      • Memoization
      • Interpreters
      • Compilers
      • Language design
      • ...

      Just the "Table of Contents" should be enough to set any red-blooded programmer on "DROOL".

      Scheme has trivial syntax. This lets the authors explore semantics in amazing detail. Scheme's semantics are explained using progressively finer (and more accurate) "models". Eventually these models are implemented, in the form of interpreters and compilers for interesting subsets of Scheme. Meanwhile, various data types are presented. Unlike the vast majority of programming textbooks, arrays and array-based types are given little space. Meanwhile, lists, trees and various (potentially) "infinite" data structures are examined.

      Models are also given for other types of programming, including a machine code, a logic programming language, and the pure functional style. Functional programming is used extensively (assignments are deliberately rare) but not fanatically.

      An amazing introduction to the subject (even if you already know it).

    • I think the authors of SICP realized there were other models out there, and I think they might disagree with the statement that lambda calculus have almost nothing to do with how computers work.

      Sussman was a co-author on several papers, the titles of which approximated: "Lambda: The ultimate goto instruction." I think Sussman and Abelson know a lot more about cs than you give them credit for.

  • It's not really a conceptual model of software, such as you seem to be seeking (pehaps barking up the wrong tree) but the Design Patterns book and community around these ideas are excellent.


    Perhaps more similar to ideas from systems theory than from ontology, design patterns are sets of abstractions and ideas that are repeatedly useful in many different contexts for solving complex problems in an elegant manner.


    As a developer, patterns are the most powerful part of my design repertoire. Conceptual models are invariably domain specific, but uses for patterns come up again and again.


    Try Design Patterns, by Gamma, Helm, Johnson and Vlissides. There are many other books in that genere, though. Analysis Patterns by Martin Fowler may be more of what you want if you're looking for domain-specific analytical abstractions.


    The book Cognitive Patterns by Karen Gardner describes a different kind of conceptual model for programming. An interesting read, but I've rarely used anything from it.


    If you really want to get into a detailed ontological perspective on programming and the world, read On the Origin of Objects by Brian Cantwell Smith. Absolutely fascinating philosophical study. Absolutely useless to a working programmer. (unless you work at PARC or Watson labs) :)

  • by alacqua ( 535697 ) on Monday June 03, 2002 @07:03PM (#3634879) Homepage
    Its been quite a while and a new edition since I read this book for a computer science class, but as I reacall the main thrust of Structure and Interpretation of Computer Programs [mit.edu] was to focus on computer science concepts in a somewhat introductory class with a minimum of syntax. It uses the Scheme dialect of Lisp which, although it was quite alien to most of the students, does not force the programmer to get bogged down in lots of syntax rules and is quite powerful. I think the author(s) explicitly stated as a goal to get right into concepts and let the student absorb the syntax along the way. And you can read it online [mit.edu] in addition to purchasing it at the bookstore.

    I'm sure many people here are already familiar with it, but if you're not it's worth a look.

  • by rufusdufus ( 450462 ) on Monday June 03, 2002 @07:04PM (#3634885)
    Getting too caught up in programming models early in as students training will almost certainly inspire them to build complex systems with huge over-generalized models. Programming models should come later, after basic syntactical and functional issues are addressed. The only model fledgling students should learn is to keep it simple. Teach them to solve problems with the least lines of codes possible, and the simplest data structures.
  • by The Pim ( 140414 ) on Monday June 03, 2002 @07:05PM (#3634887)
    It's a beautiful book, and takes basically the approach you outline. I don't have it in front of me, but I believe it treats most of the models you mention, and always focuses on the insights they give you into programs.

    It's the standard MIT intro text. Philip Greenspun called it the "one great book on the subject of computer programming". It's even online [mit.edu]!

    The only caveat is that students reportedly find it hard to absorb on the first pass--even at MIT. (This is second hand information--I didn't read SICP in a class, nor did I go to MIT. I read it after programming professionally for a few years, and loved it.)

  • by bcrowell ( 177657 ) on Monday June 03, 2002 @07:09PM (#3634918) Homepage
    Check out How to Think Like a Computer Scientist [greenteapress.com]. It's an excellent introductory book, and the digital version is also free. It does at least some of the kind of stuff you're talking about.

    However, I think it would be a mistake not to teach any syntax at the beginning. Students need concrete examples, and the only thing that makes it fun to learn how to program is that you get to build actual programs that really do things.

  • It seems obvious when you say it aloud, but the purpose of any program is to "do something". That is where I start. With what exactly it "can mean to do something".

    The fact that this is vauge is, frankly, exactly the point. I also take the student through the real-world words excersize. Particularly "what is a file? Now try again but completely forget that htere has ever been a thing called a computer; what is a file?" wearing them down to "An arbitrary collection of arbitrary things."

    Once you have done this decomposition of practical thought (typically about ten minutes of easy banter and cheap jokes) you can "really start" with the idea that there is a thing called "a state", that that thing is "only as defined as it needs to be for the task" and that any task is a transformation on that state.

    The whole lecture really involves working a crowd (of students) like you were the warm-up act for a TV sit-com live-taping audience. But done correctly you are seeding your students with the tiniest grains of everything you will be requireing them to think from there on out. Most importantly you are doing it in a non-threatening way AND showing them that what they already know is vitally important. (That's the heart of the all important act of validating your students.)

    Then you start bouncing back and forth between the practical and the theoretical.

    Basically, what you should *REALLY* do is spend a few weeks with an "english as a second language" teacher or just a plain english teacher and learn how to *TEACH* before you even think about teaching a particular subject like "programming".

    The fundimental problem with computer science is that the students are learning from the people who learned from the people who made it up in the first place, and not one of those people ever learned to "teach" any subject to anybody. -- me
    • Not to reply to my own post but...

      The most important "conceptual model" is "you already know how to solve problems, you do it every day."

      This is generally followed by:

      "This is not hard, just new/strange to you"
      and/or
      "Everything anybody can do in here, at the atomic level, is exactly analogous to something you have already done in the real world."

      The first and hardest thing to do is demystify the experience. Computer mystics program by rote formula, always recreating the same program with nearly identical structures in a cookbook-like format. Computer scientists take knowledge and use it to manufacture a good solution for each unique problem.

      Most of the freshly-minted graduates in Computer Science are Computer Mystics. If you can break down this formula approach to the subject you will get much further much faster and produce a better graduate.
  • About 40 years ago, IBM found that they could charge more from their customers if they called their programmers "Systems Analysts". The catch was that they had to find some way to differentiate the systems analysts work from that of mere "programmers". It was from that context that the basic idea of what you are asking came from.

    OK, I'm being cynical, but my point is that, in the last 40 years or so, everybody in the industry has agreed that one should have *something* that precedes programming, but there has never been a really good agreement on what should that be. Methods go in and out of fashion, just like names, Yourdon, Chris Gaine, etc.

    My tiny piece of advice, based solely on my decades of working with computers is: hire really _good_ programmers (they may be expensive, but they are worth every cent) and let them do what they like. Nothing hampers a good programmer as much as imposing a "methodology".
  • Take a look at the Mozart web page [sf.net] for a discussion of what this is. The basic idea: Your code should use the very same concepts that you have in your mind when you think about the application. A concept programming language can be extended to incorporate arbitrary forms of abstraction, not just the built-in ones (i.e. "integer", "addition", "objects" are all library things, not built-in)

    I'm currently hard at work on the first concept-programming language, called XL.
  • Computer languages, like real languages, give you the power to say things. Learning a foreign language or C++ isn't going to get you to say intelligent things.

    Because computers are so literal, you need to think out the fine details of the process as well. This is where the cardboard comes in. In essence, you assume the program works, and manually work through the data.

    You need to be conversant with your target enough to deal with all of the possibilities. To get an idea of this, read some of the bug-lists and history files of shareware.

    The other thing to do is to design the thing so that the user knows what to expect. Spreadsheets were there before computers [Stationers carry books of x or y columns].

    Once you do this, sit down with your material, and start with this program:

    /* rexx */
    call startup
    call looping
    call closure
    exit

    You break the program down into parts, and then address each part. Each part should do a clearly defined activity. This may not be just "one thing". Each routine must leave the global variables in a clearly defined state,

    More importantly, each of the controls (be they buttons or command switches) must do logical things. You can draw on your user's expectations. Putting a function at menu|F|X will draw the ire of people who use this sequence to shut the program down.

    There are of course excellent books out there. The one by Hackel [I forget the name .... will post it tonigth :)] is good, as is Knuth's "Literate Programming". Jon Bentley's comment in there is worth considering as well.

  • Lucky you. Some poor recommendations so far IMHO, with the honourable exception of SICP.

    The key thing is to keep a sense of proportion - anyone referring to UML or the GoF design patterns book has failed to understand what the fundamentals of IT are, and is certainly overestimating the relevance of their own preferred language or paradigm.

    Scheme/LISP, logic and some database theory is a good way to approach the fundamentals, as it was 15 years ago when I went through it. They won't thank you to begin with, but its what college is for! I'm not totally sold on SICP, students might think it's a bit pedantic, you might like to look at How to Design Programs [htdp.org] as an alternative. I don't have a good reference for database and logic texts - I use Joe Celko's Data and Databases [mkp.com] book, but this isn't suitable as an introduction.
  • Our professor would always (almost compulsively) draw a picture of a brain, and a picture of a box.

    The box was your state machine, and the brain was the operator/programmer/user whatever looking at some aspect of it.

    The whole concept of programming languages was explained using a sequence of grunts and sidetracks, and lots of pictures of the brain and the box with different relevant sizes :)

  • An Introduction to Programming, and Object Orientated Design
    Nino & Hosch

    That's the book I started with 7 months ago (had never programmed before, HTML doesn't count :P), and I'm very happy I did. It's a fairly theoretical book, emphasizing greatly on the fundamentals of Object Orientated design, placing Java syntax a definite second. Chapters don't teach you how to program, they teach you the development of Object Orientated design, beginning with simple classes, building test classes for those, GUIs etc.

    While this approach to programming is _very_ frustrating (I was very itchy, wanting to get ahead and start coding real programs which could actually 'do' something), it gives you a very good base from which to go on and learn more about programming. GUI's, for instance, are discussed in chapter 20 (one of the last chapters), and only AFTER completely digesting the whole Model-View-Controller pattern.

    Enough of the propaganda for this book, I'm simply a student who is very happy to have been able get such a good introduction to programming from this book. I've tried other java books in the past, only to have been irritated with the lengthy examples which they START OFF with, even before teaching you exactly what a class is.

    Problem with this book is that it doesn't really stand alone. You'll be able to grasp the concepts of OOP completely, but you'll have almost no hands-on experience, unless you pay _very_ close attention. I recommend using a second book as reference (we used a book by Kalin which I do NOT recommend, maybe an O'Reilly in a Nutshell book would be good)
  • by johnlcallaway ( 165670 ) on Monday June 03, 2002 @07:42PM (#3635101)
    I've written code (as many others have) for 25 years, starting with Fortran and assembler on punchcards, working with TRS-80 Basic, spending several years with COBOL, using perl, Java, C/C++, and such over the last 10 years, and other languages to unique or propriatary to remember. The concepts that have lasted through all the languages and methodologies, from spaghetti assembler, top-down and structured COBOL programming and now object-oriented C++ and Java, are very simple.
    • Break down what is being developed into very small components, and make them as independant of everything else as possible.
    • Develop so that relationships between components can be easily understand to lessen the impacts of any change. (One hint to a student, can he envision a cube in his head and rotate it or unfold it?? If not, maybe programming isn't for him.)
    • Write reasonably good, self documenting, maintainable code that is consistent. Teach that it might be easier to use 'i' as a variable in a short loop, but loop-idx or object_idx make more sense.
    • Which leads into the next one, LEARN TO TYPE DAMMIT. Programmers spend their career at a keyboard, they should learn to use it efficiently. That means both hands and all the fingers. Throw in the feet if you can.
    • Write self checking code that handles errors in a concise, yet informative node. I hate 'segment fault' type messages. Trap the damn things and let someone have a general idea where it occured and what dataset was being worked on if possible.
    There are probably a thousand some concepts that should be taught, but these are a few off the top of my bald head that shine through.
    • by w3woody ( 44457 )
      While I agree with most of your comments, just one point from another ol' timer. (Though only 15 years...):

      Teach that it might be easier to use 'i' as a variable in a short loop, but loop-idx or object_idx make more sense.

      Research suggests that, for complex equations and/or complex operations, shorter variable names are more easily recognized than longer variable names. That's because most people who learned algaebra recognize patterns in the equations, and using longer variable names makes the equations harder to recognize.

      Thus, "force = gravitational_constant * object_1_mass * object_2_mass / (distance * distance)" takes a little more time for the brain to parse than "f = G*m1*m2/(r*r)", even though they represent the same thing.

      With this in mind, I would suggest that if the iterator of a loop was being used as part of a mathematical operation (such as an array index), perhaps using 'i' will make the code more readable. However, if your iterator is not being used as part of a complex equation or represents an object (such as a pointer in a linked list), perhaps using a descriptive name makes more sense.

      Personally I tend to write:

      for (i = 0; i < 10; ++i) a[i] = 0;

      yet:

      for (windowPtr = GWindowList; windowPtr != NULL; windowPtr = windowPtr->next) {
      windowPtr->Update();
      }


      You get the idea.

      Just my two cents worth.
    • I've said this before, but one of the best ideas that I ever encountered was that the length of variable names should be proportional to the size of their scope. So, one the one hand, this is OK:
      for (int i=0; i<size; ++i) { ... }
      (assuming that the "..." doesn't contain any braces), but function/method arguments should be longer, like this:
      int createWidget(string name, billOfMaterials parts) {...}
      and globally-visible items (like the class and function/method names above) get the longest names.
  • I may be in the minority here but I believe you should start with some syntax before you teach design. Implementing a quality design will require syntax that most courses take weeks to get to, speaking from a C++ standpoint specifically but I believe it holds true for other languages as well. What's the point in showing someone how structures should interact if they don't have the slighest idea on how to transform that into code.

    Basic rule of software: do the right things before you worry about doing the right things well. Learning the syntax is doing the right things, proper design is doing the right things well.

    /me getting off soapbox
  • by f00zbll ( 526151 ) on Monday June 03, 2002 @10:11PM (#3635892)
    Perhaps the most important thing about teaching isn't having a well thought out study plan. It's relating to the students and figuring out how they learn. This is where many instructors get it all wrong. Teaching isn't about theory or code, it's about taking a subject and making it approachable.

    Some people prefer to read code. I definitely prefer reading code, because I think backwards and use non traditional techniques to learn programming principles. I prefer to deconstruct a piece of good code and work back to the theory that way. Some people prefer to understand the theory first and think about different approaches to apply it.

    A good teacher is one who is able to adapt the study plan to the strengths and weaknesses of the students. People should stop thinking of teaching as a mechanical process. Teaching is a creative, organic process that changes both the teacher and student. There are many smart and talented people working as teachers, who can't teach worth a dime. There are great teachers who are terrible programmers. Finding some one who is great at both is difficult.

    Perhaps you should be asking, "How do become a good teacher?" As Lao Tzsu taught, if a person wants to be a good teacher, first be a good student. The teacher has to be a student of the student to understand how and why a particular student fails, so that he can adapt the explanation/technique for that individual.

    • (* Perhaps the most important thing about teaching isn't having a well thought out study plan. It's relating to the students and figuring out how they learn. *)

      I agree!

      People tend to assume that either:

      1. Others *do* think like themselves

      and/or

      2. People *should* think like themselves

      People simply process and digest and "model" information in very different ways. What works for you may not work for others. For example, social people may learn or process information better if they envision processes as a bunch of friendly little elves interacting and cooperating with each other to get a job done.

      Although I tend to be visual, I find that some people just don't relate to diagrams and prefer some sort of written description or dialog of some sorts.

      One size does *not* fit all.
  • by BMazurek ( 137285 ) on Monday June 03, 2002 @10:30PM (#3635959)
    Your suggestion is clearly different than what most students will be expecting their course to be. (I think it is very interesting and holds promise.) You should be up front about what you are going to do, and why. I think many students will be very frustrated otherwise.

    Show them a couple of very simple constructs (like an if statement and a while loop), then show them the corresponding code in as many languages as you can. Build up in their mind that a computer language is just a tool to solve the problem .

    The language you use to solve problems isn't irrelevent (some languages are better at certain tasks than others), but at this point in their programming career, it largely is.

  • The correct model for software development is obvious:


    Frankenstein, or the Modern Prometheus [ibiblio.org] by Mary Wollstonecraft Shelley (first published 1818).


    Developing software means creating something new, that has never existed before. Something that is often cobbled together out of parts from both the living and the carcases of the recently or not-so-recently deceased. Something that, when we first try to bring it to life, often fails, badly at times. Something that we, acting as gods, mold and shape into an active entity worthy of respect from our peers and customers. The range to which software can be applied is vast, encompassing the entire spectrum of human endeavor. The consequences when we make mistakes can be devastating. Be careful out there, ok?
  • How to Design Programs (Rice) and Structure and Interpretation of Computer Programs (MIT) are two classic texts that ignore syntax and dive straight for concepts.

    -m
  • You can't beat "The Unix Programming Environment" [bell-labs.com] by Kernighan and Pike. It was a great book when it was released in 1984 and it's great now. Same for Software Tools [bell-labs.com] by Kernighan and Plaugher, from 1976.

What is research but a blind date with knowledge? -- Will Harvey

Working...