[Edu-sig] What to teach: sorting algorithms vs OOP?

2018-08-14 Thread Jurgis Pralgauskis
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: 8-616 77613
___
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] What to teach: sorting algorithms vs OOP?

2018-08-14 Thread Wes Turner
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

... Big-O 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
OOP-over-abstraction to functional with interfaces by convention with  e.g.
Go,. As a multi-paradigm 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 compile-time 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 tree-balancing
may be appropriate to teach or mention together or in an optimal sequence.

-
https://github.com/jwasham/coding-interview-university/blob/master/README.md#sorting
-
https://github.com/jwasham/coding-interview-university/blob/master/README.md#object-oriented-programming
-
https://github.com/jwasham/coding-interview-university/blob/master/README.md#design-patterns
  - 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.pralgaus...@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: 8-616 77613
>
___
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] What to teach: sorting algorithms vs OOP?

2018-08-14 Thread Wes Turner
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  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
>
> ... Big-O 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
> OOP-over-abstraction to functional with interfaces by convention with  e.g.
> Go,. As a multi-paradigm 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 compile-time 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 tree-balancing
> may be appropriate to teach or mention together or in an optimal sequence.
>
> - https://github.com/jwasham/coding-interview-university/
> blob/master/README.md#sorting
> - https://github.com/jwasham/coding-interview-university/
> blob/master/README.md#object-oriented-programming
> - https://github.com/jwasham/coding-interview-university/
> blob/master/README.md#design-patterns
>   - 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.pralgaus...@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: 8-616 77613
>>
>
___
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig