With the rapid development and application of pervasive computing and Internet of Things, more and more artificial things are augmented by seamlessly embedding new capabilities such as sensing, actuating, communication and calculation. Compared with their traditional counterparts, the augmented artifacts can perform complex tasks more intelligently, automatically, and even collaboratively. These augmented artifacts are referred to as smart things (or smart objects), which are becoming basic building blocks of Internet of Things and driving the emergence of novel pervasive applications. However, programming smart things faces challenges because they are dynamic and inherently heterogeneous in terms of their built-in functionalities, computational capabilities, network interfaces, etc. This paper proposes an interaction mechanism and programming abstraction to support smart things-based application development. A middleware system is implemented to realize the interaction mechanism and programming abstraction while providing runtime support for heterogeneous smart things. With the help of the proposed programming abstraction and interfaces, application developers can easily program smart household appliances such as smart TV, smart air conditioner, smart projector, smart light, and so on. Case studies and experimental results show that the proposed smart things based approach can be utilized to develop systems and applications of the Internet of Things flexibly and effectively.