Totally Unclutchable – Part 1
The best way to learn to code is to actually code. I have read this in many places in recent months and now, over two months into my apprenticeship, it is making more and more sense. Until recently, I had written mainly to the console. It was time to try something new. Introducing Totally Unclutchable, a fictional car rental company with an interesting name. This is my first experience of windows forms.
To begin, I was given very clear specifications for the windows form. In brief, it needed to have a Cars Module, a Customers Module and a Booking Module. A user can add, edit and delete cars and customers. The Bookings Module allows the user to assign available cars to customers in order to create a booking. At this stage of my apprenticeship, I require a lot of scaffolding with the instructions. In time, I will to design a program more independently.
To get the ball rolling, I learned about how to connect my windows app to a SQL database of customers, cars and bookings. To do so, I needed to use a connection string and make use of the SqlConnection class. It is good practice to close any connections before proceeding. Over the course of the project, I needed to make various calls to the database. I learned a great deal about the format of a query. I learned the hard way that SQL and C# have different formats for dates. This was important in the AddCar and AddCustomer forms, where I needed to validate the information that is input by the user.
Using Object-Orientated Design has been a challenge for me in this project. I’ve had to understand the how classes and objects can interact with each other. Prior to beginning, I had a shaky understanding of constructors and methods, but I feel that I have made progress in these areas. I recognise the importance in planning the design and layout of a program in advance. Totally Unclutchable features a series of forms and manager classes.
I had no idea how much time I would spend on debugging when I started Totally Unclutchable. Debugging has helped me to find syntax errors, to correct data types, and to correct SQL queries. As I progress as a developer, I am aware that I will spend more and more time debugging.
What I’ve learned so far
While initially daunting, this project has helped me better understand Object Orientated Design. I had done quite a bit of reading, but nothing beats actually writing code. I have found it quite rewarding to work with windows forms as there is something to show for my efforts; there will be a working product by the end of the project. I have gained experience in using Visual Studio. Its tools for debugging have been particularly helpful.
The Bookings module of my program remains. I will have to calculate whether a car is available, assign customers to available cars and check that they qualify for the rental. I have a great deal of work left to do. Join me next time to see if I can get Totally Unclutchable on the road!