Most Stack Exchange sites about computer platforms aimed at the general public¹ exclude programming questions: Android, Apple, Unix & Linux, Windows Phone, ... The ostensible reason is that Stack Overflow existed first and already covers programming questions, including questions about programming for Apple, Android, etc.
I think the key point is who the audience of the site is. Android.SE caters to Android users; Android programmers would be a totally different audience. Apple.SE caters to users of Apple devices, etc.
Ask Ubuntu chose a different path. Initially all programming questions were declared to be on-topic, as long as the programmer was working on Ubuntu. But over the years this has become a minority view, with a majority holding that programming questions are only on-topic if they're specific to Ubuntu. The help centre still says it is on topic, however.
I think a somewhat similar policy would make sense on this site. I propose:
Programming questions are on-topic if they are specifically about elementary OS.
That is, “how do I add two numbers in PHP on elementary OS” would be off-topic because there's nothing specific about elementary OS. But “I've written an application with a gtk-based GUI, how do I make sure it blends in on elementary” would be on-topic.
Note that scripting is a different matter. It's a matter of audience: programming is done by programmers, scripting is done by users and administrators — even if scripts are programs. This should be discussed in a separate meta thread.
¹ As opposed to e.g. Mathematica, Raspberry Pi, TeX, etc. which have somewhat specialist audiences.