
Overview on Mediation
Jul 17,2020
Programming is at the core of computer science and related subjects, such as software engineering, and web/mobile development. Regardless of what academic level you are studying at, there are best practices that can apply at every level. This article will provide some useful information for students who are new to programming.
1. Naming Variables
Give your variables meaningful names, and stick with a naming style throughout your code. Good examples include:
String clientFullName;
int pageCount;
bool isValid;
In the above examples you can see that the name of each variable is descriptive enough so that prefixes are not required, e.g. clientFullName instead of strClientFullName. Capitalising every word after the first word means that you don’t have to use underscores to separate words in your variable names. E.g. clientFullName instead of client_full_name. This also results in less typing effort on your part. These naming conventions can also be applied to class, method, and function names.
2. Assignment and Equality
Assignment means that you are giving a variable or object a value. This is done with a single equals sign:
int pageCount = 5;
Equality is when you are testing two variables to see if they have the same value. This is done with two equals signs:
if (pageCount == maxPageCount)
{
// your code goes here…
}
3. Comments
If you add comments to your code, keep the comments brief. Comments should complement the code, not re-iterate the obvious. Well written code should make it reasonably obvious as to what it is doing. In industry, many people will often work on the same sections of code over a long period of time. If your code is so complex that it needs a long written description in the comments, then you may need to look at making your code simpler to understand. This will also help you too if you come back to your code at a later date, and have forgotten how it originally worked.
4. Use the Web
The web is perhaps the greatest resource for documentation for all computer programming languages. There are countless forums dedicated to each language, where you can either search for similar questions, or ask new ones. There are often many ways to solve a programming problem, and the chances are that other people have already come across the problems you are encountering. A popular phrase in computing is “do not re-invent the wheel”. This applies to many individual programming problems, but it shouldn’t always be used as a rule of thumb when you need to complete essays and assignments. The web is a useful tool for finding solutions to specific, smaller problems, but you are unlikely to find the full answer to an essay or assignment question, which will usually require the combination of lots of problems to be solved to complete a bigger task.
5. Break Big Problems into Smaller Problems
Following on from point 4, your essays and assignments will often involve completing a large task. You should break this large task down into smaller problems. This is a fundamental skill required in most areas of computer science and related subjects. If you have been given an assignment question such as “Create a web site for a company that sells clothes online”, you should visualise what will be the component parts required to solve the larger problem. E.g. a static web site has a front-end (HTML), you’ll need somewhere to store product and customer data, so you’ll also need a database. You’ll need a way for the web site to display the product data, for this you could use PHP and SQL, and so on… This will allow you to focus on solving one problem at a time, which will help you to better manage the time for development.
Filed Under: Computer Programming
User Type: | Tutor Verified |
Name: | Bill |
Uploaded Date: | Nov 15,2016 |
Experienced private tutor who can convey complex subjects in simple terms. I have tutored and mentored students in computing and related subjects to help them obtain high marks for assignments, exams, and final year projects.