What to teach: sorting algorithms vs OOP?
Hi, The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge.. OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :) I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms. What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
You can probably do sorting, inheritance, and interfaces at the same time? An ISortable object must have a .sort() method. e.g. DoublyLinkedList(LinkedList). "15 Sorting Algorithms in 6 Minutes" https://youtu.be/kPRA0W1kECg  # of comparisons  # of array accesses ... BigO Cheat Sheet http://bigocheatsheet.com  "Array Sorting Algorithms"  Time Complexity: Best, Average, Worst  Space Complexity: Worst I don't have K12 students. It's important to learn OOP. There really is a push back from OOPoverabstraction to functional with interfaces by convention with e.g. Go,. As a multiparadigm language built on C (not C++ (OOP which predates Java)), programs can be written in many styles with Python. There is  some might argue negligible  overhead to each function call. Is there a good way to do compiletime interface checking with Python? Why not? zope.interface is probably the most popular way to do 'actual' interfaces in Python. https://zopeinterface.readthedocs.io/en/latest/ Pyramid framework has zope.interface interfaces. https://github.com/Pylons/pyramid/blob/master/pyramid/interfaces.py  IResponse  IRequest (a 'marker' interface) An OOP exercise: # Namespacing def area_of_a_rectangle() def perimeter_of_a_rectangle() def shape__rectangle__area() def shape__square__area() # Inheritance, Interfaces, Parameters class Shape() def __init__(*args, **kwargs): # * def area() def perimeter() def height/width/[depth]() # physical units # class Number(float): # def __init__(value, unit=) class Square() class Rectangle() class Triangle() Sorting, [multiple] database indexes (import sqlite), and treebalancing may be appropriate to teach or mention together or in an optimal sequence.  https://github.com/jwasham/codinginterviewuniversity/blob/master/README.md...  https://github.com/jwasham/codinginterviewuniversity/blob/master/README.md...  https://github.com/jwasham/codinginterviewuniversity/blob/master/README.md...  https://en.wikipedia.org/wiki/Software_design_pattern  OOP sorted() is implemented with/as a Timsort (and expects an interface (is it __cmp__, __gt__, __lt__, AND __eq__?)). https://wiki.python.org/moin/TimeComplexity On Tuesday, August 14, 2018, Jurgis Pralgauskis < jurgis.pralgauskis@gmail.com> wrote:
Hi,
The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge..
OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :)
I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
Someone can probably better explain how setattr(object) and setattr(object()) work in regards to `self` as a bound positional parameter? Also, @classmethod and @staticmethod. On Tuesday, August 14, 2018, Wes Turner <wes.turner@gmail.com> wrote:
You can probably do sorting, inheritance, and interfaces at the same time?
An ISortable object must have a .sort() method. e.g. DoublyLinkedList(LinkedList).
"15 Sorting Algorithms in 6 Minutes" https://youtu.be/kPRA0W1kECg  # of comparisons  # of array accesses
... BigO Cheat Sheet http://bigocheatsheet.com  "Array Sorting Algorithms"  Time Complexity: Best, Average, Worst  Space Complexity: Worst
I don't have K12 students.
It's important to learn OOP. There really is a push back from OOPoverabstraction to functional with interfaces by convention with e.g. Go,. As a multiparadigm language built on C (not C++ (OOP which predates Java)), programs can be written in many styles with Python.
There is  some might argue negligible  overhead to each function call. Is there a good way to do compiletime interface checking with Python? Why not?
zope.interface is probably the most popular way to do 'actual' interfaces in Python. https://zopeinterface.readthedocs.io/en/latest/
Pyramid framework has zope.interface interfaces. https://github.com/Pylons/pyramid/blob/master/pyramid/interfaces.py  IResponse  IRequest (a 'marker' interface)
An OOP exercise:
# Namespacing def area_of_a_rectangle() def perimeter_of_a_rectangle() def shape__rectangle__area() def shape__square__area()
# Inheritance, Interfaces, Parameters class Shape() def __init__(*args, **kwargs): # * def area() def perimeter() def height/width/[depth]() # physical units # class Number(float): # def __init__(value, unit=) class Square() class Rectangle() class Triangle()
Sorting, [multiple] database indexes (import sqlite), and treebalancing may be appropriate to teach or mention together or in an optimal sequence.
 https://github.com/jwasham/codinginterviewuniversity/ blob/master/README.md#sorting  https://github.com/jwasham/codinginterviewuniversity/ blob/master/README.md#objectorientedprogramming  https://github.com/jwasham/codinginterviewuniversity/ blob/master/README.md#designpatterns  https://en.wikipedia.org/wiki/Software_design_pattern  OOP
sorted() is implemented with/as a Timsort (and expects an interface (is it __cmp__, __gt__, __lt__, AND __eq__?)).
https://wiki.python.org/moin/TimeComplexity
On Tuesday, August 14, 2018, Jurgis Pralgauskis < jurgis.pralgauskis@gmail.com> wrote:
Hi,
The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge..
OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :)
I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
Hi Jurgis  I've tried various approaches with K12, noting that's in itself a wide spectrum i.e. K is nothing like 12. I'll focus on high school (912). I'd say the ubiquity (omnipresence) of the "dot operator" as "accessor" suggests working it into ordinary mathematical thinking, at first as a way to reach "attributes" (properties) and second as a way to trigger behaviors. noun.attribute versus noun.behavior(). Why isn't "dot notation" part of everyday math? Given the influx of CS in lower grades, I'd say it's becoming so, defacto. One mathematical object that calls out for such treatment is the Polyhedron, since that's obviously mathematical anyway, and is clearly an Object in the most literal sense. Polyhedrons are colorful and accessible and help make that bridge to game engines providing visuals.
tet = Tetrahedron() # could come with many defaults tet.edges 6 tet.vertexes 4 tet.faces 4
What behaviors do we expect from a polyhedron? For starters: tet.rotate(degrees, axis) tet.scale() tet.translate(vector). We see how surface area increases as a 2nd power of change in linear scale, volume as a 3rd power e.g.:
tet.volume 1 bigtet = tet.scale(2) # double all edge lengths bigtet.volume 8 biggest = tet.scale(3) # triple all edge lengths biggest.volume 27
Your earlier focus on sorting might still be used, as a typical behavior of mathematical objects, such as lists. Your focus is perhaps less on the algorithms used and more on the syntax e.g. .items() as a behavior of the dict type. That segment in Python where we show how to sort on any element of a tuple might be worth covering:
polyvols = {"tetrahedron":1, "octahedron":4, "cube":3, "cuboctahedron":20} vols_tuples = tuple(polyvols.items()) vols_tuples (('tetrahedron', 1), ('octahedron', 4), ('cube', 3), ('cuboctahedron', 20))
sorted(vols_tuples) # alphabetical [('cube', 3), ('cuboctahedron', 20), ('octahedron', 4), ('tetrahedron', 1)]
sorted(vols_tuples, key=lambda t: t[1]) # by volume, get to use lambda [('tetrahedron', 1), ('cube', 3), ('octahedron', 4), ('cuboctahedron', 20)]
another way, not using lambda, shown in the docs on sorting:
from operator import itemgetter getvol = itemgetter(1) # get item 1 of a tuple or other object using __getitem__ getvol(('tetrahedron', 1)) 1
sorted(vols_tuples, key=getvol) [('tetrahedron', 1), ('cube', 3), ('octahedron', 4), ('cuboctahedron', 20)]
https://docs.python.org/3.7/howto/sorting.html Like Wes said, you could bridge to inheritance here (if in Python, interfaces are less required as we have multiple inheritance). class Polyhedron # base class could implement the generic guts of a polyhedron with subclasses like: class Tetrahedron(Polyhedron) class Cube(Polyhedron) class Octahedron(Polyhedron) class Cuboctahedron(Polyhedron) ... The special names __lt__ __eq__ __gt__ for <, ==, > will even let you implement sorting, in say volume order. #!/usr/bin/env python3 # * coding: utf8 * """ Created on Wed Aug 15 08:31:57 2018 @author: Kirby Urner """ class Polyhedron: def __lt__(self, other): return self.volume < other.volume def __gt__(self, other): return self.volume > other.volume def __eq__(self, other): return self.volume == other.volume def scale(self, factor): return type(self)(v=self.volume * factor**3) def __repr__(self): return "{}(v={})".format(type(self).__name__, self.volume) class Tetrahedron(Polyhedron): "Self dual, spacefiller with octahedron" def __init__(self, v=1): self.volume = v self.edges, self.vertexes, self.faces = (6, 4, 4) class Cube(Polyhedron): "Dual of Octahedron, spacefiller" def __init__(self, v=3): self.volume = v self.edges, self.vertexes, self.faces = (12, 8, 6) class Octahedron(Polyhedron): "Dual of Cube, spacefiller with tetrahedron" def __init__(self, v=4): self.volume = v self.edges, self.vertexes, self.faces = (12, 6, 8) class RhDodecahedron(Polyhedron): "Dual of Cuboctahedron, spacefiller" def __init__(self, v=6): self.volume = v self.edges, self.vertexes, self.faces = (24, 14, 12) class Cuboctahedron(Polyhedron): "Dual of Rh Dodecahedron" def __init__(self, v=20): self.volume = v self.edges, self.vertexes, self.faces = (24, 12, 14) mypolys = (Tetrahedron(), Cuboctahedron(), Octahedron(), Cube()) volume_order = sorted(mypolys) print(volume_order) from operator import attrgetter name = attrgetter("__class__.__name__") # >>> name(Tetrahedron()) # 'Tetrahedron' name_order = sorted(mypolys, key= name) print(name_order) OUTPUT: By volume: [Tetrahedron(v=1), Cube(v=3), Octahedron(v=4), Cuboctahedron(v=20)] By name: [Cube(v=3), Cuboctahedron(v=20), Octahedron(v=4), Tetrahedron(v=1)] https://twitter.com/itsmikebivins/status/1029552016849129472 Note: these are not necessarily familiar volumes outside a curriculum informed by American literature. https://medium.com/@kirbyurner/bridgingthechasmnewenglandtranscendental... https://en.wikipedia.org/wiki/Synergetics_(Fuller)#Tetrahedral_accounting My artscience courses tend to phase in the above conventions under the rubric of "Martian Math". https://flic.kr/s/aHsmi8go79 Kirby On Tue, Aug 14, 2018 at 12:46 PM, Jurgis Pralgauskis < jurgis.pralgauskis@gmail.com> wrote:
Hi,
The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge..
OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :)
I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
_______________________________________________ Edusig mailing list Edusig@python.org https://mail.python.org/mailman/listinfo/edusig
OUTPUT: By volume: [Tetrahedron(v=1), Cube(v=3), Octahedron(v=4), Cuboctahedron(v=20)] By name: [Cube(v=3), Cuboctahedron(v=20), Octahedron(v=4), Tetrahedron(v=1)] [ weird tweet link appears here in the archive ] Interesting that a URL to a tweet (not one of mine) snuck into the archived copy of this message, even though I don't see it in the outgoing or incoming emailed versions. It shows the Portland skyline these days, when regional forest fires have made the atmosphere really hazy. https://mail.python.org/pipermail/edusig/2018August/011990.html (archived post) Kirby (wearing listowner hat) On Wed, Aug 15, 2018 at 9:01 AM, kirby urner <kirby.urner@gmail.com> wrote:
Hi Jurgis 
I've tried various approaches with K12, noting that's in itself a wide spectrum i.e. K is nothing like 12.
I'll focus on high school (912).
I'd say the ubiquity (omnipresence) of the "dot operator" as "accessor" suggests working it into ordinary mathematical thinking, at first as a way to reach "attributes" (properties) and second as a way to trigger behaviors. noun.attribute versus noun.behavior(). Why isn't "dot notation" part of everyday math? Given the influx of CS in lower grades, I'd say it's becoming so, defacto.
One mathematical object that calls out for such treatment is the Polyhedron, since that's obviously mathematical anyway, and is clearly an Object in the most literal sense. Polyhedrons are colorful and accessible and help make that bridge to game engines providing visuals.
tet = Tetrahedron() # could come with many defaults tet.edges 6 tet.vertexes 4 tet.faces 4
What behaviors do we expect from a polyhedron?
For starters:
tet.rotate(degrees, axis) tet.scale() tet.translate(vector).
We see how surface area increases as a 2nd power of change in linear scale, volume as a 3rd power e.g.:
tet.volume 1 bigtet = tet.scale(2) # double all edge lengths bigtet.volume 8 biggest = tet.scale(3) # triple all edge lengths biggest.volume 27
Your earlier focus on sorting might still be used, as a typical behavior of mathematical objects, such as lists.
Your focus is perhaps less on the algorithms used and more on the syntax e.g. .items() as a behavior of the dict type.
That segment in Python where we show how to sort on any element of a tuple might be worth covering:
polyvols = {"tetrahedron":1, "octahedron":4, "cube":3, "cuboctahedron":20} vols_tuples = tuple(polyvols.items()) vols_tuples (('tetrahedron', 1), ('octahedron', 4), ('cube', 3), ('cuboctahedron', 20))
sorted(vols_tuples) # alphabetical [('cube', 3), ('cuboctahedron', 20), ('octahedron', 4), ('tetrahedron', 1)]
sorted(vols_tuples, key=lambda t: t[1]) # by volume, get to use lambda [('tetrahedron', 1), ('cube', 3), ('octahedron', 4), ('cuboctahedron', 20)]
another way, not using lambda, shown in the docs on sorting:
from operator import itemgetter getvol = itemgetter(1) # get item 1 of a tuple or other object using __getitem__ getvol(('tetrahedron', 1)) 1
sorted(vols_tuples, key=getvol) [('tetrahedron', 1), ('cube', 3), ('octahedron', 4), ('cuboctahedron', 20)]
https://docs.python.org/3.7/howto/sorting.html
Like Wes said, you could bridge to inheritance here (if in Python, interfaces are less required as we have multiple inheritance).
class Polyhedron # base class
could implement the generic guts of a polyhedron with subclasses like:
class Tetrahedron(Polyhedron) class Cube(Polyhedron) class Octahedron(Polyhedron) class Cuboctahedron(Polyhedron) ...
The special names __lt__ __eq__ __gt__ for <, ==, > will even let you implement sorting, in say volume order.
#!/usr/bin/env python3 # * coding: utf8 * """ Created on Wed Aug 15 08:31:57 2018
@author: Kirby Urner """
class Polyhedron:
def __lt__(self, other): return self.volume < other.volume
def __gt__(self, other): return self.volume > other.volume
def __eq__(self, other): return self.volume == other.volume
def scale(self, factor): return type(self)(v=self.volume * factor**3)
def __repr__(self): return "{}(v={})".format(type(self).__name__, self.volume)
class Tetrahedron(Polyhedron): "Self dual, spacefiller with octahedron"
def __init__(self, v=1): self.volume = v self.edges, self.vertexes, self.faces = (6, 4, 4)
class Cube(Polyhedron): "Dual of Octahedron, spacefiller"
def __init__(self, v=3): self.volume = v self.edges, self.vertexes, self.faces = (12, 8, 6)
class Octahedron(Polyhedron): "Dual of Cube, spacefiller with tetrahedron"
def __init__(self, v=4): self.volume = v self.edges, self.vertexes, self.faces = (12, 6, 8)
class RhDodecahedron(Polyhedron): "Dual of Cuboctahedron, spacefiller"
def __init__(self, v=6): self.volume = v self.edges, self.vertexes, self.faces = (24, 14, 12)
class Cuboctahedron(Polyhedron): "Dual of Rh Dodecahedron"
def __init__(self, v=20): self.volume = v self.edges, self.vertexes, self.faces = (24, 12, 14)
mypolys = (Tetrahedron(), Cuboctahedron(), Octahedron(), Cube()) volume_order = sorted(mypolys) print(volume_order)
from operator import attrgetter name = attrgetter("__class__.__name__")
# >>> name(Tetrahedron()) # 'Tetrahedron'
name_order = sorted(mypolys, key= name) print(name_order)
OUTPUT:
By volume: [Tetrahedron(v=1), Cube(v=3), Octahedron(v=4), Cuboctahedron(v=20)] By name: [Cube(v=3), Cuboctahedron(v=20), Octahedron(v=4), Tetrahedron(v=1)] https://twitter.com/itsmikebivins/status/1029552016849129472 Note:
these are not necessarily familiar volumes outside a curriculum informed by American literature. https://medium.com/@kirbyurner/bridgingthechasm newenglandtranscendentalisminthe1900s1dfa4c2950d0 https://en.wikipedia.org/wiki/Synergetics_(Fuller)#Tetrahedral_accounting
My artscience courses tend to phase in the above conventions under the rubric of "Martian Math". https://flic.kr/s/aHsmi8go79
Kirby
On Tue, Aug 14, 2018 at 12:46 PM, Jurgis Pralgauskis < jurgis.pralgauskis@gmail.com> wrote:
Hi,
The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge..
OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :)
I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
_______________________________________________ Edusig mailing list Edusig@python.org https://mail.python.org/mailman/listinfo/edusig
Hi Jurgis, As I had very similar problems in my high school teaching often enough, let me add my two cents' worth here. In contrast to Wes' and Kirby's reply, I am focusing much more on the idea of algorithms than on the software/programming side, and would advocate to give sorting algorithms a fair try ^_^. I think the first question is really what your curriculum's objective is. If we are talking about computer science, then doing the sorting algorithms is probably the right choice. If it really is about programming, then OOP might be an acceptable alternative to consider. The tricky part is that programming often comes as part of general computer science education, so the disctinction between the two is not always that easy. And if we are talking about computer science as a (more or less) mandatory subject for everyone, then please keep in mind that you are not training future software engineers, and not everyone is becoming a programmer. Anyway, before teaching sorting algorithms, it might be a good idea to think about the reasons for teaching it. As you have pointed out, sorting is available as a builtin function in nearly every programming system, and CPython has a very sophisticated implementation, indeed, which will almost always be better than what you can do with students. Hence, teaching sorting algorithms can obviously not be just about the sorting. However, one thing you will have used over and over again as a programmer is, of course, optimisation. As programmers, whenever possible, we want to come up with an elegant, fast, and efficient solution. I strongly believe, it is this process of optimisation, of finding more efficient, and clever solutions, that we should be teaching to K12 students. And one of the best examples to demonstrate this process is through sorting. Why? Because the students can relate to the task in the first place (the understand the problem easily enough), and because we can easily achieve impressive speedups with approachable algorithms. What I want to say is, that directly teaching something like Quicksort to K12 students has no positive effect, whatsoever. It is just a dead piece of code, probably something to be learned for the next test, and forgotten just as quickly. But, if we manage to rather focus on the process of starting with a really dumb sorting algorithm, and then discuss various approaches, and their limitations, of how we can improve it, and make it more efficient, then we get to truly engaging lessons. Hence, teaching sorting is not about sorting, really, but about how you can improve the efficiency of a program. For this reason, I usually start with sorting early on. Perhaps something as simple as taking two values, and returning them in ascending order (i. e., `min, max`). Once you enhance this basic idea to three values, the function quickly gets much more complicated, and my students tend to write long series of `if``elif`chains, something like: def sort_three(a, b, c): if a <= b <= c: return a, b, c elif a <= c <= b: return a, c, b elif b <= a <= c: return b, a, c ... Once you arrive at four values, things turn quickly nasty. Even with the three values above, it becomes hard to reason about the reliability of the function. Have we covered all the cases? Does it return the correct order for every conceivable cornercase? Which is the right branch to be taken if all three values are equal, and where (in the code) do we actually test for that? At this point, the idea of Minsort to the rescue! Instead of trying to cover every case, we try to think of a different approach, where we first identify the smallest element. This might, for instance, look as follows. def sort_three(a, b, c): if a <= b and a <= c: x = a y, z = sort_two(b, c) elif b <= a and b <= c: x = b y, z = sort_two(a, c) elif c <= a and c <= b: x = c y, z = sort_two(a, b) return x, y, z Note that at this point, we have already started to bring in the idea of recursion, without actually doing proper recursion. But demonstrating this basic idea in different settings will help us later on. As a next step, we can then go to do the same thing with lists (the actual implementation here will vary, depending on what you have discussed so far with your students). def sort(input_list): output_list = [] while len(input_list) > 0: x = min(input_list) input_list.remove(x) output_list.append(x) return output_list One problem that occurs with this implementation is that the original list is being destroyed. So, again, this gives rise to discuss several implementation issues. Finally, depending on what situation you are actually in, you can really do both, and cover sorting algorithms, as well as OOP (as Wes and Kirby have already pointed out). From my experience: in an elective class for 12th graders (who already knew the basics of Python programming), I implemented a very simple 3Dengine. To that end, the graphical objects need to be build from triangles, and what is more natural than representing these triangles as objects? But, once we start to rotate the camera, so as to give a real 3Dimpression, we need to make sure that the triangles are painted in the correct order: we need to sort them according to their depth. So, sorting does not only come in as quite natural a requirement, it is also evident that the sorting needs to be fast, because we want to repaint the scene several times every second. Unfortunately, it took me about half a year to cover this entire programme with about two hours each week. This included, of course, a treatment of various projections, matrices, and all the other fun stuff. But it might still give you yet another idea of how to approach the subject. I hope you will find a nice solution to your dilemma. Cheers, Tobias Quoting Jurgis Pralgauskis <jurgis.pralgauskis@gmail.com>:
Hi, The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge.. OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :) I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613
OUTPUT: By volume: [Tetrahedron(v=1), Cube(v=3), Octahedron(v=4), Cuboctahedron(v=20)] By name: [Cube(v=3), Cuboctahedron(v=20), Octahedron(v=4), Tetrahedron(v=1)] === Here's a Jupyter Notebook version of my posting from this morning: https://github.com/4dsolutions/SAISOFT/blob/master/OrderingPolys.ipynb I'll test it out with my adult Python students this evening. We've been looking at sorting and lambda expressions. Diving into Polyhedrons as a topic, without actually rendering them, would be frustrating. Fortunately, I've already got rendering backends implemented, going back some decades. http://www.4dsolutions.net/ocn/cp4e.html When it comes to merging math with OOP, I think Polyhedrons look very promising. Kirby
I'm glad Tobias took the bull by the horns and didn't eschew a deeper look into the sorting algorithms. As a big fan of animations, my reflex is to scour Youtube for graphical renderings of the different strategies, but then another thought crops up: lets get out of our seats and do choreography, Math is an Outdoor Sport! (PR poster). I should explain. The relationships between programming and scripting theater "programmes" (old spelling) are deep. Give each student a postit with a number and have them *enact* the sorting algorithm. E.g. starting in a row, turn to person on your left (if there is one) and swap places if your postit number is higher... have directors and make a video. Now choreograph (enact, dance) in a different way. Symphonies, plays, musicals, are so multitrack, so parallel, and yet we fail to exploit those intuitions sometimes. Let the Theater Department handle it, in consultation with CS. Could go under the heading of "Unplugged". Likely the Hobbits are already doing this in New Zealand (NZ has pioneered unplugged more than most, plus has Hobbits). Seriously, having lived in the Philippines where people routinely learn group dancing, I'm worried about only acting as teams in three capacities (a) cheerleader (b) athlete on the field (c) band. Theater is being eliminated in favor of competitive sports. Perhaps CS could come to the rescue and say "wait, we need Theater for our simulations". More cerebral teambased activities might go a long way towards fighting the stereotype that computer programmers only live in artificially lit basements eating pizza. That's a physically damaging lifestyle, nothing to do with writing code or even doing math. === Regarding last night's teleclass (real time, zoom.us), I worked through "cloning a github repo" as the core exercise, a repeat from last week, then went through the process of updating a notebook live, and pushing the changes back to the repo. The repo was of course the one with yesterday's Jupyter Notebook about Ordering Polyhedrons by volume. https://github.com/4dsolutions/SAISOFT I tell them "cloning a github repo" is going to be important for when they want like a Jake Vanderplas tutorial, i.e. when they want to study a topic in more depth and the workshop is (A) on Youtube or similar service and (B) the workshop materials are free via github (a common enough pattern). I also reminded them how Google shares TensorFlow in the form of Colab exercises (Jupyter Notebooks). One students asked "R or Python, which is winning in Data Science"? My answer: pandas is a relatively recent development and there's already lots of excellent curriculum based around R, which is likewise free / open source. The business world is rushing into Python because of DL / ML and so gains an Rlike tool in the process, which enables better towngown relations i.e. Harvard can talk to Facebook about Pytorch thanks to already teaching R in the stats department. In other words, it's not either/or, more like two communities forming a bridge via the common language of data science, which R and Python both reflect (as do some other languages / ecosystems, not aiming for comprehensivity here). Kirby On Wed, Aug 15, 2018 at 10:04 AM, Tobias Kohn <kohnt@tobiaskohn.ch> wrote:
Hi Jurgis,
One of my most memorable classes was Introduction to Algorithms. Not because I have ever needed to implement a linked list, but because it opened my eyes to a much larger field of knowledge than just knowing language syntax. I went into the class wondering what could I possibly learn? I left knowing the possibilities are endless. On Tue, Aug 14, 2018 at 2:47 PM Jurgis Pralgauskis <jurgis.pralgauskis@gmail.com> wrote:
Hi,
The dillema I have when teaching: our k12 curricullum of programming is more based on algorithms (math ideas), but when working as programmer, I see the bigger need of SW architecture knowledge..
OOP is one big topic, which could replace sorting alg stuff (that I never applied (directly) in this century...). The topics could be integrated in making mini game engine :)
I'd still leave classics of sum, min search, and search in sorted vs non array to get the idea of algorithms.
What are your approaches, if you have programming classes in K12?  Jurgis Pralgauskis tel: 8616 77613 _______________________________________________ Edusig mailing list Edusig@python.org https://mail.python.org/mailman/listinfo/edusig
I couldn't agree more! Such interactive programmes are often so much more valuable than hours of talking (even though doing interactive programmes all the time will wear the students out  as always, there is golden middle here ^_^). Another idea in that direction is to make two or three groups, and then have a little competition of who can sort a pile of postits (or whatever) fastest. And I would recommend to surprise the students. Once they have learned how to sort numbers, say, give them postits with picture of animals, say, or melodies, or whatever you fancy. That forces them to think outside of the box, and suddenly computer science class becomes so much more meaningful and memorable! Yet another idea: how about sorting Morse code? Usually, we get it sorted from 'A' to 'Z'. But there are other ways, and before you know it, you are discussing trees... Cheers, Tobias Quoting kirby urner <kirby.urner@gmail.com>:
I'm glad Tobias took the bull by the horns and didn't eschew a deeper look into the sorting algorithms. As a big fan of animations, my reflex is to scour Youtube for graphical renderings of the different strategies, but then another thought crops up: lets get out of our seats and do choreography, Math is an Outdoor Sport! (PR poster). I should explain. The relationships between programming and scripting theater "programmes" (old spelling) are deep. Give each student a postit with a number and have them *enact* the sorting algorithm. E.g. starting in a row, turn to person on your left (if there is one) and swap places if your postit number is higher... have directors and make a video. Now choreograph (enact, dance) in a different way. Symphonies, plays, musicals, are so multitrack, so parallel, and yet we fail to exploit those intuitions sometimes. Let the Theater Department handle it, in consultation with CS. Could go under the heading of "Unplugged". Likely the Hobbits are already doing this in New Zealand (NZ has pioneered unplugged more than most, plus has Hobbits). Seriously, having lived in the Philippines where people routinely learn group dancing, I'm worried about only acting as teams in three capacities (a) cheerleader (b) athlete on the field (c) band. Theater is being eliminated in favor of competitive sports. Perhaps CS could come to the rescue and say "wait, we need Theater for our simulations". More cerebral teambased activities might go a long way towards fighting the stereotype that computer programmers only live in artificially lit basements eating pizza. That's a physically damaging lifestyle, nothing to do with writing code or even doing math. === Regarding last night's teleclass (real time, zoom.us[1]), I worked through "cloning a github repo" as the core exercise, a repeat from last week, then went through the process of updating a notebook live, and pushing the changes back to the repo. The repo was of course the one with yesterday's Jupyter Notebook about Ordering Polyhedrons by volume. https://github.com/4dsolutions/SAISOFT I tell them "cloning a github repo" is going to be important for when they want like a Jake Vanderplas tutorial, i.e. when they want to study a topic in more depth and the workshop is (A) on Youtube or similar service and (B) the workshop materials are free via github (a common enough pattern). I also reminded them how Google shares TensorFlow in the form of Colab exercises (Jupyter Notebooks). One students asked "R or Python, which is winning in Data Science"? My answer: pandas is a relatively recent development and there's already lots of excellent curriculum based around R, which is likewise free / open source. The business world is rushing into Python because of DL / ML and so gains an Rlike tool in the process, which enables better towngown relations i.e. Harvard can talk to Facebook about Pytorch thanks to already teaching R in the stats department. In other words, it's not either/or, more like two communities forming a bridge via the common language of data science, which R and Python both reflect (as do some other languages / ecosystems, not aiming for comprehensivity here). Kirby
On Wed, Aug 15, 2018 at 10:04 AM, Tobias Kohn <kohnt@tobiaskohn.ch> wrote:
_Hi Jurgis,_
Links:  [1] http://zoom.us
Optimization for realworld data. Morse code is a good one; which leads to the entropy of realworld English letters: how probable are the letters A, E, and Z? How probable is the 3gram of letters 'AEZ'? A wellbalanced tree could take this knowledge into account and sparsely add 'nodes' without needing to rebalance as often. Pairtree with hashes is an interesting realworld problem. Filesystems have a max number of file entries per directory. A good cryptographic hash has equal probabilities of e.g. hexadecimal character occurrence for each digit: each digit character has an equal probability of following any other digit. Shannon used these probabilities for something; I can't remember what it was? One (TEDEd) YouTube video I found mentioned sorting library books; what's the fastest way? Sorting is not strictly necessary for topk Ndimensional optimization: tracking high and low points doesn't require sorting the whole (then ordered or partially ordered) set. Here's an example from https://wrdrd.github.io/docs/consulting/datascience# optimization : Optimization⬅ https://en.wikipedia.org/wiki/Mathematical_optimization Find local and global optima (maxima and minima) within an ndimensional field which may be limited by resource constraints. # Global optima of a 1dimensional list points = [10, 20, 100, 20, 10] global_max, global_min = max(points), min(points) assert global_max == 100 assert global_min == 10 # Local optima of a 1dimensional list sample = points[:1] local_max, local_min = max(sample), min(sample) assert local_max == 20 assert local_min == 10 # A 2dimensional list ... points = [(0.5, 0), (0, 0.5), (0.5, 0), (0, 0.5)] https://en.wikipedia.org/wiki/Optimization_(disambiguation) https://en.wikipedia.org/wiki/Metaheuristic https://en.wikipedia.org/wiki/Receiver_operating_characteristic http://rayli.net/blog/data/top10dataminingalgorithmsinplainenglish/ http://scikitlearn.org/stable/tutorial/machine_learning_map/ https://en.wikipedia.org/wiki/Firefly_algorithm On Thursday, August 16, 2018, Tobias Kohn <kohnt@tobiaskohn.ch> wrote:
I couldn't agree more! Such interactive programmes are often so much more valuable than hours of talking (even though doing interactive programmes all the time will wear the students out  as always, there is golden middle here ^_^).
Another idea in that direction is to make two or three groups, and then have a little competition of who can sort a pile of postits (or whatever) fastest. And I would recommend to surprise the students. Once they have learned how to sort numbers, say, give them postits with picture of animals, say, or melodies, or whatever you fancy. That forces them to think outside of the box, and suddenly computer science class becomes so much more meaningful and memorable!
Yet another idea: how about sorting Morse code? Usually, we get it sorted from 'A' to 'Z'. But there are other ways, and before you know it, you are discussing trees...
Cheers, Tobias
Quoting kirby urner <kirby.urner@gmail.com>:
I'm glad Tobias took the bull by the horns and didn't eschew a deeper look into the sorting algorithms.
As a big fan of animations, my reflex is to scour Youtube for graphical renderings of the different strategies, but then another thought crops up: lets get out of our seats and do choreography, Math is an Outdoor Sport! (PR poster). I should explain.
The relationships between programming and scripting theater "programmes" (old spelling) are deep. Give each student a postit with a number and have them *enact* the sorting algorithm. E.g. starting in a row, turn to person on your left (if there is one) and swap places if your postit number is higher... have directors and make a video. Now choreograph (enact, dance) in a different way.
Symphonies, plays, musicals, are so multitrack, so parallel, and yet we fail to exploit those intuitions sometimes.
Let the Theater Department handle it, in consultation with CS. Could go under the heading of "Unplugged". Likely the Hobbits are already doing this in New Zealand (NZ has pioneered unplugged more than most, plus has Hobbits).
Seriously, having lived in the Philippines where people routinely learn group dancing, I'm worried about only acting as teams in three capacities (a) cheerleader (b) athlete on the field (c) band. Theater is being eliminated in favor of competitive sports. Perhaps CS could come to the rescue and say "wait, we need Theater for our simulations".
More cerebral teambased activities might go a long way towards fighting the stereotype that computer programmers only live in artificially lit basements eating pizza. That's a physically damaging lifestyle, nothing to do with writing code or even doing math.
===
Regarding last night's teleclass (real time, zoom.us), I worked through "cloning a github repo" as the core exercise, a repeat from last week, then went through the process of updating a notebook live, and pushing the changes back to the repo.
The repo was of course the one with yesterday's Jupyter Notebook about Ordering Polyhedrons by volume.
https://github.com/4dsolutions/SAISOFT
I tell them "cloning a github repo" is going to be important for when they want like a Jake Vanderplas tutorial, i.e. when they want to study a topic in more depth and the workshop is (A) on Youtube or similar service and (B) the workshop materials are free via github (a common enough pattern).
I also reminded them how Google shares TensorFlow in the form of Colab exercises (Jupyter Notebooks).
One students asked "R or Python, which is winning in Data Science"?
My answer: pandas is a relatively recent development and there's already lots of excellent curriculum based around R, which is likewise free / open source. The business world is rushing into Python because of DL / ML and so gains an Rlike tool in the process, which enables better towngown relations i.e. Harvard can talk to Facebook about Pytorch thanks to already teaching R in the stats department.
In other words, it's not either/or, more like two communities forming a bridge via the common language of data science, which R and Python both reflect (as do some other languages / ecosystems, not aiming for comprehensivity here).
Kirby
On Wed, Aug 15, 2018 at 10:04 AM, Tobias Kohn <kohnt@tobiaskohn.ch> wrote:
*Hi Jurgis,*
On Thu, Aug 16, 2018 at 11:24 AM, kirby urner <kirby.urner@gmail.com> wrote:
I'm glad Tobias took the bull by the horns and didn't eschew a deeper look into the sorting algorithms.
As a big fan of animations, my reflex is to scour Youtube for graphical renderings of the different strategies
e.g.: https://youtu.be/ZZuD6iUe3Pc Check out the BBC spin (heavy into sorting): https://youtu.be/gOKVwRIyWdg (I'd gladly show this in my school) Kirby
participants (5)

Carl Karsten

Jurgis Pralgauskis

kirby urner

Tobias Kohn

Wes Turner