What Programming Language Features Are Well Suited for Developing a Live Coding Framework

What programming language features are well suited for developing a live coding framework?

Clojure has pretty much everything you are likely to want as a live coding language. Main highlights:

  • Interactive REPL - so you can interact directly with your running program. Even when I'm doing "traditional programming" I tend to write code interactively and copy the bits I like into a source file later. Clojure is just designed to work this way - pretty much everything in your program is inspectable, modifiable and replaceable at runtime.
  • Great concurrency support - you can kick off concurrent background tasks trivially with code like (future (some-function)). More importantly, Clojure's STM and emphasis on high performance immutable data structures will take care of the more subtle concurrency aspects (e.g. what happens if I update a live data structure while it is in the middle of being rendered??)
  • Library availability - it's a JVM language so you can pull in all the audio, visual, IO or computational tools you require from the Java ecosystem. It's easy to wrap these in a line or two of Clojure so that you get a concise interface to the functions that you need
  • Macros - as Clojure is a homoiconic language you can take advantage of the Lisp ability to write powerful macros that extend the language. You can effectively build the exact syntax that you want to use in the live environment, and let the compiler do all the hard work of creating the complete code behind the scenes.
  • Dynamic typing - the benefits of this can be argued both ways, but it's certainly a huge benefit when trying to write code quickly and concisely.
  • Active community with a lot of cool projects - you're likely to find a lot of people interested in similar live coding techniques in the Clojure community.

A couple of links you might find interesting:

  • Paul Graham on Lisp - beating the averages
  • Live Clojure coding example with the Overtone sound synthesizer (a frontend to SuperCollider)

Where can I find a good tutorial/introduction to Live Coding?

The Toplap website has links to people, audio, gigs, tools and demos. There are some introductory exercises there which provide some pointers. Chuck is an example of one of the programming languages used for this type of coding. Supercollider is an integrated environment and audio programming language that looks pretty good.

What's available for livecoding music?

Check these resources:

  • SuperCollider (Environment and programming language for real time audio synthesis and algorithmic composition)
  • ChucK (Strongly-timed, Concurrent, and On-the-fly Audio Programming Language)
  • TOPLAP (temporary organization for the proliferation of live audio programming)

Looking for a programming language for dummies

If you consider Lua too hard, then you're probably not looking for a generic programming language (another suggestion would be Python). Instead consider creating a domain-specific language. I'll be making some assumptions here about your game, but you could, for example, implement a rule-based scripting language where each script represents an enemy's behaviour:

can_see(player) and distance_to(player) > 100:
run_towards(player)

can_see(player) and distance_to(player) < 100:
shoot_at(player)

default:
wander()

At each reasoning step the first matching rule could be executed. In that case some form of hysteresis will be needed to prevent your NPCs from appearing decisionless.

This basically reduces your programming language to a single if-else-if with a limited amount of keywords and operators to be used. You could even create a custom editor with IntelliSense specifically for your language. If your users are up for it you could have nested rules:

can_see(player):
distance_to(player) > 100:
run_towards(player)
default:
shoot_at(player)

At some point you could start allowing variables and user-defined functions, but then a general purpose language might have been a better choice from the start! So you see, the main question is finding a balance between genericity and user-friendliness.

What's a good lightweight programming language that compiles to native windows code?

if it's lightweight and nothing complicated, and you are familiar with the C family of languages.. then why not C and the Win32 Api? It's harder than writing .net or java programs, sure but it's definitely going to compile to native windows code, and doesn't need bytecode or an interpreter.

Also, you might be able to use Mono to statically link a C# application with the Mono runtime. http://www.mono-project.com/Guide:Running_Mono_Applications

I see you need to brush up on C..here's another idea, then : Delphi.

There are some more answers in this thread

Suggestions for writing a programming language?

Estimating how long something like that might take is dependent on many different factors. For example, an experienced programmer can easily knock out a simple arithmetic expression evaluator in a couple of hours, with unit tests. But a novice programmer may have to learn about parsing techniques, recursive descent, abstract representation of expression trees, tree-walking strategies, and so on. This could easily take weeks or more, just for arithmetic expressions.

However, don't let that discourage you. As Jeff and Joel were discussing with Eric Sink on a recent Stack Overflow podcast, writing a compiler is an excellent way to learn about many different aspects of programming. I've built a few compilers and they are among my most memorable programming projects.

Some classic books on building compilers are:

  • Compilers: Principles, Techniques, and Tools (also known as The Dragon Book)
  • The Structure and Interpretation of Computer Programs (also known as SICP)
  • Algorithms + Data Structures = Programs

What are the main differences between the popular web frameworks?

I am going to briefly address each area for three popular Python frameworks. This is only based on my personal experiences and observations.

Development speed and convenience

For TurboGears, Pylons, and Django, development speed is roughly equal. Being modern frameworks, it's easy to get started on a new site and start throwing together pages. Python is famously fast to develop and debug and I would put any Python framework as having a shorter development time than any other setup I've worked with (including PHP, Perl, Embedded Perl, and C#/ASP.Net).

Barriers to entry - developer training and infrastructure

If you know Python and are willing to watch a 20 minute video tutorial, you can create a fairly complete wiki-type site from scratch. Or you can walk through a social-bookmarking site tutorial in 30 minutes (including installation). These are TurboGears examples but the other two frameworks have nearly identical tutorials as well.

The test/development infrastructure that comes out of the box with these frameworks is generally enough to complete most sites. At any point, you can swap out components to meet your production environment requirements. For example, SQLite is fine for setting up your models and loading test data, but you will want to install MySQL (for example) before going live or storing large amounts of data.

In all cases, the requirements are very low and dictated entirely by your scalability requirements and not any peculiarities of the framework. If you are comfortable with a certain template language or ORM, it will probably plug right in.

Lock-in

This is a generalized problem across all frameworks. When you select a language, you limit your code-reuse options. When you select a templater, you are again locked in (although that's easier to change, in general, than other things). The same goes for your ORM, database, and so on. There is nothing these frameworks do specifically that will help or hinder lock-in.

Flexibility

It's all about MVC with these three frameworks. As you said, that's a very different discussion!

Performance, scalability, and stability

Well, if you write good code, your site will perform well! Again, this is a problem across all frameworks addressed by different development techniques and is probably way outside the scope of this answer.



Related Topics



Leave a reply



Submit