3

Some programming languages allow you be deceptive, for better or for worse. C is an obvious example, and of course assembler is even better at that.

What languages make it hard to be deceptive? I guess this is a 2 part question - Q1: what popular languages (Python, Java, etc.) are not easy sneak things into, and Q2: are there language especially designed to disallow deceptive practices?

(I'm asking about deception at the source code level, languages whose source code is doesn't lend itself to deception.)

tshepang
  • 12,111
  • 21
  • 91
  • 136
obelia
  • 2,105
  • 2
  • 13
  • 11
  • Define "deception" and "sneaky". – deceze Feb 19 '14 at 08:48
  • @deceze - Just the common definitions of those words, I think. Imagine you're writing an accounting program, and your source code will be reviewed to make sure you're not putting a secret backdoor in there to do anything criminal, but you want to put that backdoor in, so you have to write code that is deceptive so your intension is not obvious - that's sneaky and deceptive. The link in my post is illustrative of what I'm talking about: http://underhanded.xcott.com/ – obelia Feb 19 '14 at 08:59
  • This question might be a better fit for http://programmers.stackexchange.com/. – smokris Feb 19 '14 at 16:07

1 Answers1

3

I think this question is a little hard to answer definitively. Most programming languages I have used could be used to mislead the developer. It is written in code after all.

I think one of the worst offenders would be JavaScript. JavaScript lets you get away with so many confusing practices. Some examples are things like using a variable without declaring it, scopes not being defined by loops/conditionals - but functions, the strange way threads are handled in JS/browsers, the compatibility between browsers, the name conflicts, it goes on. There are a lot of ways to get hung up.

Now, I think something opposite of that would be a strongly-typed language with an aggressive and ubiquitous IDE like C#. There are many warnings, and "suggestions" that the IDE/compiler provides. I may just be saying that cause I understand C# the best. Java is probably pretty similar to C# in this regard.

Another way of measuring sneakiness would be how side-effects are handled. In that case, a (mostly)purely functional language like haskell might be a good example. Functional langugaes can often be proven correct with significantly less effort than a similar piece of code in a language with a different paradigm.

So a strongly-typed language with a good IDE might be the best way to catch any sneakiness for someone with not much experience in that language. I think if you are an expert in a functional language, it'd be much less likely to get away with any sneakiness there. Maybe the perfect balance is F#!

Community
  • 1
  • 1
Gray
  • 7,050
  • 2
  • 29
  • 52