Is It appropriate to put code in slides for a technical presentation?
It may or may not be appropriate, depending on your audience (I also feel this way about equations). A couple things to keep in mind:
- If you have non-technical people in your audience, you'll likely lose them for these slides, and there's a risk you'll lose them entirely.
- Even if people are technically-inclined, they now need to read your code block, interpret it in their mind, and think about it long enough to see your point. And they'll have the distraction of you talking to them at the time. That's a pretty steep thing to ask your audience to do.
Generally, I think you'll likely be better served talking about these issues conceptually, rather than with code, which will require people to wade through it. If you must include code blocks, make sure they are clear, in a very recognizable style (no personal quirks or idioms, clear variable names, etc.) and clearly annotated as you walk through it.
But honestly, I don't think I've ever seen a talk with code-as-content (beyond "These 2 lines instead of these 15!") that I thought was aided by having it there.
I suggest testing your slide, using colleagues with similar skills to the target audience. As Fomite pointed out in a prior answer, listening to a speaker and reading code can be difficult to do at the same time.
One option would be to allow time for the code reading: "Please examine this code block" followed by a pause. You can find out how long a pause is needed by observing your test audience. If you cannot afford to allow enough time to read and understand the code, get rid of it.
If it is a technical talk on a particular library then yes, code is appropriate, and in some cases - even recommended (as opposed to hand waving).
But:
- keep it readable (big font, syntax highlighting, reasonable variable names),
- keep it short (examples as minimal as possible),
- give enough time to read and understand it.
Some examples how it is being done: this slide or for async JS: this presentation.