DarthDemono’s Notes for Programming L+Pr / IP-18fPROGEG

This class isn’t “just C# coding”. It’s basically training the same solution in multiple forms, in order to train your programming skills. The goal is that when you see a task, you can translate it into a patterned solution, not freestyle it every time AKA Analogous programming.

  • Course code: IP-18fPROGEG
  • Credits: 6

When analogies are used with programming by example (PBE), the result is a new end-user programming paradigm combining the elegance of PBE to create programs with the power of analogies to reuse programs. The combination of PBE with analogies is called programming by analogous examples (PBAE). (Repenning & Perrone, 2001)

Setup (what you install + what you create)

You’ll write everything as a C# console program.

1) Install tools

  • Install Visual Studio Community (Windows).
  • Install .NET (if VS installer doesn’t already include it, install the latest supported .NET SDK/runtime from Microsoft).
  • In VS, make sure the C# workload is enabled.

2) Create a project correctly

  • Open Visual Studio → Create a new project
  • Choose: C# Console App
  • Important: select “Do not use top-level statements”
    • This keeps your program structure consistent (classic Main, predictable file layout), which matters for learning + submissions.

The 4–5 things you’re actually learning

You’re expected to get comfortable with these:

  1. C# code in Visual Studio
  2. Specification tool: https://progalap.elte.hu/specifikacio/#
  3. Structogram tool: https://progalap.elte.hu/stuki/
  4. Reduction tables / pattern tables
  5. Patterns in all three forms: spec + structogram + code

That last part is the real theme: the class wants you to recognize a pattern and express it in:

  • a formalish specification (pre/post),
  • a clean algorithm (structogram),
  • and the actual C# implementation.

How the “patterns” idea works

Instead of inventing a new solution style per task, you learn reusable patterns like:

  • counting
  • summation
  • search (exists / first match)
  • min/max selection
  • filtering/copying/transforming

Then you “reduce” a problem into one (or a combination) of these patterns. Once you can do that, tasks become mechanical: pick pattern → fill in condition/expression → implement.

My honest experience (what’s hard vs easy)

For me, specification was the toughest part. The official spec documentation was in Hungarian, so I made this: Specifikacio. Structogram is honestly easy once you get the symbols and structure—what matters is keeping it consistent with your specification.

In C#, the only parts that consistently feel annoying are:

  • 2D arrays
  • structs (especially when input/output format gets strict)

Console I/O: the thing that silently ruins points

A lot of my mistakes weren’t “logic mistakes”, they’re input parsing / output formatting mistakes. For arrays, you’ll commonly see two formats:

Format A: each element on a new line

Example array [1,2,3,4,5] as console input:

1
2
3
4
5

Format B: space-separated on one line (harder)

1 2 3 4 5

You need to be comfortable handling both, because the “space-separated” one requires splitting and indexing correctly.

Example Project

This is an example project of what you should expect from your C# Classes.

References

  1. Repenning, A., & Perrone, C. (2001). Chapter 18 - Programming by analogous examples. In H. Lieberman (Ed.), Your wish is my command (pp. 351–318). Morgan Kaufmann. https://doi.org/10.1016/B978-155860688-3/50019-1