Recent studies have demonstrated that Drosophila melanogaster (briefly Drosophila) can successfully perform higher cognitive processes including second order olfactory conditioning. Understanding the neural mechanism of this behavior can help neuroscientists to unravel the principles of information processing in complex neural systems (e.g. the human brain) and to create efficient and robust robotic systems. In this work, we have developed a biologically-inspired spiking neural network which is able to execute both first and second order conditioning. Experimental studies demonstrated that volume signaling (e.g. by the gaseous transmitter nitric oxide) contributes to memory formation in vertebrates and invertebrates including insects. Based on the existing knowledge of odor encoding in Drosophila, the role of retrograde signaling in memory function, and the integration of synaptic and non-synaptic neural signaling, a neural system is implemented as Simulated fly. Simulated fly navigates in a two-dimensional environment in which it receives odors and electric shocks as sensory stimuli. The model suggests some experimental research on retrograde signaling to investigate neural mechanisms of conditioning in insects and other animals. Moreover, it illustrates a simple strategy to implement higher cognitive capabilities in machines including robots.