ebook img

Oop - Learn Object Oriented Thinking and Programming PDF

527 Pages·2013·5.92 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Oop - Learn Object Oriented Thinking and Programming

Academic series Ing. Rudolf Pecinovský, CSc. is a graduate of Faculty of Nuclear Science and Physical Engeneering at Czech Technical University in Prague. He obtained his Ph.D. (CSc.) degree at Institute of Information Theory and Automation, Czechoslovak Academy of Sciences. He is a lector at Faculty of Informatics and Statistics, University of Economic, Prague, Faculty of Information Technology, Czech Technical University in Prague and at College of information Management, Business Administration and Law. He published more than 40 textbooks. OOP – Learn Object Oriented Thinking and Programming by Rudolf Pecinovský, CSc. 2013 This book is published both in printed as well as PDF form. You can find the detailed information about it at http://pub.bruckner.cz/titles/oop, where you can also download the PDF version. OOP – Learn Object Oriented Thinking and Programming Copyright © Rudolf Pecinovský, 2013 Translation Irena Mihovičová Published in the Czech Republic by Tomáš Bruckner, Řepín – Živonín, 2013 Academic Series This book was reviewed by Doc. MUDr. Jiří Kofránek, CSc., Charles University in Prague, Doc. Ing. Vojtěch Merunka, Czech University of Life Sciences Prague, Doc. Ing. Miroslav Virius, CSc., Czech Technical University in Prague Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identifica- tion and explanation without intent to infringe. Paperback printed on demand and worldwide distributed by Lightning Source UK Ltd. Pitfield UK and Lightning Source Inc. La Vergne TN US. New prints are available for ordering in every bookstore. Visit us at http://pub.bruckner.cz ISBN 978-80-904661-8-0 (paperback) ISBN 978-80-904661-9-7 (PDF) Reaction of Readers I consider this book to be unique, above all due to the fact that the author has realized the importance of knowing the object programming than throwing out hundreds of statements and functions. The book is written in an autobiographical way which I noticed first time in textbooks and especially in programming textbooks. Thanks to it I had really good feeling from reading the book. Another aspect that I appreciated is a lot of available animations. Due to them I always knew what and where I should do. The book thus becomes pleasantly simplified, which has a great affect for beginning young programmers as for example me. I have no reservations to this book and I can only warmly recom- mend it to all who are powerlessly swamped in the object oriented programming world. Ladislav Janeček a beginning programmer What I appreciated in the book, it was among other things the fact, that the author explained the terms in an interesting style and that, at the very beginning; he explained items which are usually explained in more advanced courses, but which have important consequences. I always appreciate progressive explaining, so that you cannot meet a situation when you are reading a code and you do not under- stand it because you are missing certain advanced knowledge. When reading the book, the author does not press on the reader to quickly write the code and so the reader starts to write down the source code after learning the OOP basics. I would recommend this book to anybody who wants to learn OOP. Anyway, I felt sorry for one thing, and it is that I did not know the book when I started to learn the OOP. Martin Škurla a programmer Programming is my hobby. I recommend the books of Rudolf Pecinovský to all who really want to get into the secret of OOP and do not want to finish at programs of “Hello World” type. The book is really suitable even for real beginners, especially for the so called “perpetual” beginners, who would like to learn programming, but the topic seems to them too complicated and discouraging. Majority of cur- rent books can teach you to develop simple programs from the beginning, but they mention OOP only marginally, as if it would be something extra. Terms like design patterns are unknown for them. Luck- ily the exceptions do exist. This is one of them. If not Mr. Pecinovský, I could be a perpetual beginner, maybe only pseudo OOP programmer. Martin Staněk an intermediate advanced student All the literature which I have read until now on OOP was only a dry theory that I was not able to apply in practice. I am glad that I discovered this book. It helped me to transfer the theory to practice. With impatience I am expecting another volume of the book, with which I can get to the core of the OOP. Stanislav Hruška a self-learner programmer You cannot find a lot of Czech textbooks of programming, where you “yourself” could make a pro- gram for car races at the end of the book. And what is the dream of each young beginning program- mer? To program a game and show it off to friends. In case you are really interested in programming, this book can really help you in your long way. Programming is not a matter of several weeks or months, but you can become a good programmer within several years. Sophisticated examples and accompanying animations are an important part of the technical text. Examples and animations are made out in a top professional quality and are added to each chapter of the book. Examples, animations, development environment BlueJ as well as Java, this is all FREE, without any charges! All is functioning in Windows as well an in Linux. The book is written according to the methodology Design Pattern First; the object oriented pro- gramming (OOP) and draft patterns are contemporary phenomenon. The presentation is ambitious, but can be mastered. I would recommend this book to all who really have a serious interest in OOP. This book is according to my opinion very suitable as a textbook of programming for high schools as well as for universities for branches aimed to information technologies. Jiří Kubala, an IT teacher, High School of Informatics, Ostrava-Poruba This book presents the OOP in a little bit different way compared to other textbooks. Not only because it is written as a dialogue of an “I-Know-Nothing” and “A Wise-Old-Man”, but the way how it presents the Object Programming differs from current programming textbooks. It’s difficult to say whether it’s a better way, but it’s fully suitable for me and I think it may be fully suitable also for those readers who started programming hundred times and hundred times they failed. I can describe it as if you would unsuccessfully cut a piece of wood, and suddenly, when you put your saw to the other hand, you could cut it somewhat more easily. And that’s the case of this book. Despite I already knew many paragraphs from other books, this one enabled me to see certain mat- ters from a different view. I appreciate a lot that the book shows an already developed program, i.e. not only independent examples, but you can see relations among separate parts of the program. I also welcome the possibility to see the videos/animations at the author’s websites which are of great help in case the text is not fully understandable or the description by words would be too long. I am looking forward for the second volume of this book. Tibor Bako an OOP beginner This is an ideal book for beginners as well as for experienced programmers. It is written in a style which is attractive and keeps attentiveness for the firstly named. The needed knowledge and skills are gradually presented in a pleasant, gentle and natural style and immediately demonstrated and rein- forced by examples and exercises. To more experienced programmers it provides a different view (and according to me the proper one) on object oriented programming. Vít Grafnetter a programmer Contrary to a number of other programming textbooks which I have read, this one does not overload the reader with only a lot of new statements, but teaches him real programming. And it makes it in a very original and comprehensible form. Despite the fact it is determined to younger beginning readers, it was a great contribution for me. Michal Palas a high school student Dedicated to my wife Jaruška and to my children Stephanie, Pavlínka, Ivanka and Michal viii OOP – Learn Object Oriented Thinking and Programming Brief Content Acknowledgement ...................................................................................................................................................................... xx Preface ........................................................................................................................................................................................ xxi Author’s Foreword ................................................................................................................................................................... xxiii Part 1: Interactive mode .................................................................... 1 1 The Prologue ............................................................................................................................................................................. 2 2 The OOP – Get Acquainted ............................................................................................................................................... 10 3 We Are Sending First Messages ........................................................................................................................................ 18 4 The Test Class ........................................................................................................................................................................ 25 5 The Messages Requiring a Value ....................................................................................................................................... 33 6 The Messages Requiring an Object ................................................................................................................................... 43 7 The Messages with Parameters .......................................................................................................................................... 50 8 The Object Type Parameters .............................................................................................................................................. 59 9 The Expedition into the Interior of Instances ..................................................................................................................... 68 10 The Interface ....................................................................................................................................................................... 77 11 The Interface Continued .................................................................................................................................................... 89 12 The Introduction into Design Patterns ............................................................................................................................ 100 13 The Inheritance of Interface Types ................................................................................................................................ 108 14 Mediator and Listener ..................................................................................................................................................... 121 Part 2: Basics of Creating OO Programs ....................................... 133 15 The First Code ................................................................................................................................................................... 134 16 The First Constructor ......................................................................................................................................................... 144 17 Parameters ........................................................................................................................................................................ 150 18 The Fields and the Methods ............................................................................................................................................ 157 19 Implementation of an interface .................................................................................................................................... 169 20 Comments ........................................................................................................................................................................... 181 21 Using of this ....................................................................................................................................................................... 194 22 Overloading ...................................................................................................................................................................... 202 23 The Local Variables ......................................................................................................................................................... 212 24 Methods Returning a Value ............................................................................................................................................ 221 25 The Crate ........................................................................................................................................................................... 231 26 Strings and How to Work with Them ............................................................................................................................ 240 Brief Content ix 27 A Bit of Logic ..................................................................................................................................................................... 251 28 Class Methods and Fields ............................................................................................................................................... 263 29 Refactoring of the Code ................................................................................................................................................. 276 30 Static Constructor – Class Constructor ........................................................................................................................... 289 31 Debugger .......................................................................................................................................................................... 308 32 Creating of an Standalone Application ....................................................................................................................... 319 Part 3: Advanced Creating of OO Programs ................................. 329 33 Packages ........................................................................................................................................................................... 330 34 Linking of Instances ........................................................................................................................................................... 346 35 Decorator ........................................................................................................................................................................... 366 36 Teaching Cars to Turn ...................................................................................................................................................... 380 37 Controlling from Keyboard ............................................................................................................................................ 390 38 Containers and Maps ...................................................................................................................................................... 407 39 Further Programming Constructions ............................................................................................................................... 420 40 The Factory Method Second Time ................................................................................................................................. 434 41 The Loops ........................................................................................................................................................................... 444 42 Lists and Their Ordering .................................................................................................................................................. 469 43 The Array ........................................................................................................................................................................... 483 44 The Finale .......................................................................................................................................................................... 494 Index .......................................................................................................................................................................................... 495

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.