Page 168 - DCAP310_INTRODUCTION_TO_ARTIFICIAL_INTELLIGENCE_AND_EXPERT_SYSTEMS
P. 168

Introduction to Artificial Intelligence & Expert Systems




                    Notes          blocks of applications from an object-oriented perspective. Each different type of object comes
                                   from a specific class of that type. A class is a blueprint or template or set of instructions to build
                                   a specific type of object. Every object is built from a class. Each class should be designed and
                                   programmed to accomplish one, and only one, thing. (You’ll learn more about the Single
                                   Responsibility Principle in Object-oriented programming concepts: Writing classes.) Because
                                   each class is designed to have only a single responsibility, many classes are used to build an
                                   entire application. An instance is a specific object built from a specific class. It is assigned to a
                                   reference variable that is used to access all of the instance’s properties and methods. When you
                                   make a new instance the process is called instantiation and is typically done using the new
                                   keyword. Think about classes, instances, and instantiation like baking a cake.
                                   A class is like a recipe for chocolate cake. The recipe itself is not a cake. You can’t eat the recipe
                                   (or at least wouldn’t want to). If you correctly do what the recipe tells you to do (instantiate it)
                                   then you have an edible cake. That edible cake is an instance of the chocolate cake class. We can
                                   bake as many cakes as you would like using the same chocolate cake recipe. Likewise, you can
                                   instantiate as many instances of a class as you would like. Pretend you are baking three cakes for
                                   three friends who all have the same birthday but are different ages. You will need some way to
                                   keep track of which cake is for which friend so you can put on the correct number of candles. A
                                   simple solution is to write each friend’s name on the cake. Reference variables work in a similar
                                   fashion. A reference variable provides a unique name for each instance of a class. In order to
                                   work with a particular instance, you use the reference variable it is assigned to.

                                       !
                                     Caution Learn the basic concepts of OOPs before implementing it.




                                      Task  Make a Java program for small calculator using objects and classes.


                                   Self Assessment

                                   State whether the following statements are true or false:
                                   15.  Every object is built from a class.

                                   16.  Objects are the fundamental building blocks of applications from an object-oriented
                                       perspective.

                                   8.9 Summary


                                       The Hopfield is an auto-associative network often used (or derivatives of it) in monochrome
                                       image recognition.
                                       A script is a data structure used to represent a sequence of events. Scripts are used for
                                       interpreting stories. Popular examples have been script driven systems that can interpret
                                       and extract facts from Newspaper Stories.

                                       The object-oriented approach to programming is based on an intuitive correspondence
                                       between a software simulation of a physical system and the physical system itself.
                                       Frame is a type of schema used in many AI applications including vision and natural
                                       language processing. Frames provide a convenient structure for representing objects that
                                       are typical to stereotypical situations.





          162                               LOVELY PROFESSIONAL UNIVERSITY
   163   164   165   166   167   168   169   170   171   172   173