OOP vs Functional

Rhyolight

  • A state checkpoint/restore on an HTM system

We have model serialization in NuPIC. It just doesn’t always work well.

BItking
One of the many reasons I despise OOP.

PERL & C for me!

Both do OOP if absolutely necessary, and both let you skip it if you don’t need the baggage that comes with OOP.

Note that the concept Code Smells (things that suggest that something is amiss with your code) is mostly composed of things OOP related.

1 Like

Every programming-related community of a certain age eventually has this discussion.

I want a language that can provide both, like python or javascript. I use both methods a lot. For example, my encoders are OOP, but my ui code is all functional (because web browser event loops).

4 Likes

Functional all the way! Haskell for the win!

Functional allows concurrent programming, integration of networked components, integration of libraries with threaded dependencies, and interaction with time-sensitive asynchronous and even multiple levels of nested asynchronous interactions – WITHOUT SYNCHRONIZATION! :slight_smile:

OOP allows rich semantics which reflect real world features being modeled.

Neither is better…

We are all waiting breathlessly for the Haskell (Or lisp?) re-write of the Nupic system.

Clojure is a lisp.

2 Likes

I actually have started learning Haskell for this purpose, but can’t say it is sticking yet. Eventual hope would be to compile to FPGA with Clash and deploy to AWS F1 for HTM in hardware.

3 Likes

seems like not much going for OOP… :wink:

Saw some project about compiling general haskell code into hardware for an FPGA, if that’s what your’e talking about.

Hehehe! OOPs been talked up o’ plenty! Plus, I got bored and wanted to stop typing! :stuck_out_tongue:

OOP is all about talk and no actual benefit :smirk:

2 Likes

GASP! Don’t look now, but your bias is showing! :slight_smile:

I know, I have a huge bias towards FP and Procedural and I’m not shy about it. Even wrote up an article a while back: https://medium.com/@matantsuberi/oop-is-hypocrite-you-cant-avoid-fp-c4f67b4696a0

Also here’s another smirk biased guy talking about OOP:

2 Likes

Actually was referring to this: http://www.clash-lang.org/

1 Like

I programmed with lisp & Smalltalk many years ago.

Lisp never felt very natural to me and I don’t look back fondly on the time spent with these languages.

In the years since then I have never had a project where I said to myself - this would be perfect for lisp!

Or Smalltalk for that matter.

What about the downside of having everything you do produce a copy? How do you program for embedded systems with a behemoth that sneezes out object copies for every function (so as not to create side-effects)?

Didn’t they figure out a way around that with Ehrlang? Not sure… Still new to FP. But sometimes you want to reach in and modify your objects, don’t you? I mean, it’s just so damn efficient and convenient! :slight_smile:

I agree that imperative is the choice for efficiency, but even when doing that I’d prefer Procedural programming over OOP anytime. simple C over the half breed monster C++.

2 Likes

Well I guess we can agree to agree; and stand firm in our agreement that we are agreed? :slight_smile:

1 Like

Form is Function.

Although a compatible GPU is required I have to mention CUDA, or similar parallel language for at least coding each brain process into separate CPU cores:

In both the spatial network model I’m experimenting with and a cortical sheet HTM models are based upon are hexagonally located CCU’s that need to be horizontally interconnected into a single network. The question is then (regardless of being written for parallel or not) what is the most efficient way to start with perhaps the simplest thing possible and pass waves by making each 6 bit CCU output the Not/Complement of its input? Optionally it’s then possible to cancel out signals that arrive at the same time, timestep. Either way the wave pattern matches the (signal geometry) concordant pair numbers from live rats during 2 frame place avoidance, though I can’t yet in neuroscientific detail explain exactly why.

The way a GPU forces the problem to be sorted out into information pipelines always seemed to me like the ideal starting point, where from there it’s coded into the closest language to CUDA, using loops instead. After that anything that gets written would be easy to recode for parallel.

I thought it would be helpful to describe the programming dilemma I’m having. It’s for me a very first step in setting up a hexagonal array. What the horizontal connections between neighboring CCU’s look like in parallel code might help set a standard for all of us working with them.

1 Like