| |||||||||||
| |||||||||||
First Class Java. First step and moving forward.
Java is an Object Oriented language that's great for medium size through large to huge systems. Which means that it's not usually the best approach for short applications ... of the size that one typically uses as examples on a training course. So examples that I produce show mechanisms and extensibility rather than practical use in themselves. ((Put another way - why use a system of directory and file management, a.k.a. packages and classes, when you've only got one or two files!))
So here - for anyone who gets presented with a large Java project to maintain - is a very short "hello Java objects" example that shows a single class, nothing complicated, called from a single simple test program. public class HotelBooking {And here's the test program: public class TestHotel {I run that and I get [trainee@snowdrop bkp]$ java TestHotelBut of course there's a lot more to Java than that!. I went on to enhance my examples to include several different methods to create hotel bookings (overloading), to specifiy that some variables are private, to add in arrays of objects, and to place my HotelBooking class into a package of its own so that it can leater be easily bundled with a whole series of other classes. And then you move on to saying that "I have a booking - but it's not a normal one; it differs because it's in association with an event". Rather than duplicate the code for a regular booking, which would mean that there was thereafter double the maintainance, in Java you'll describe the event booking as extending the regular booking and you'll only supply the extra functionallity and changed coding. You can then extend classes in a number of different ways, giving you a whole alternative series of different booking types ... which you can hold in an array or something similar, and you'll rapidly find that you have a powerful application coming together, easy to maintain as the code for each piece of logic is only there once, and easy to enhance as you can very easily add in extra subclasses. Why a Java example today? Because I was teaching a Java Bootcamp yesterday! And I'll be running another Bootcamp, and also an extended Java Programing for the Web at the end of next month. (written 2008-01-10 07:52:58) Associated topics are indexed under J706 - Java - Objects and Classes
Some other Articles
Flooding by Asda-s proposed new supermarketWeb page (http) error status 405 Java, sorting, ArrayList example, generics Java - using super to call a method in the parent class First Class Java. First step and moving forward. Climate change, renewable resources and paper v plastic Java is a dynamic language .... (and comparison) Training Season Starts again! PHP / Web 2 logging Single login and single threaded models - Java and PHP 1780 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 at 50 posts per pageThis is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price. Link to Ezine home page (for reading). Link to Blogging home page (to add comments). |
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho | |||||||||||