Lessons on programming
Here is going be some links to posts that I have done regarding different aspects of programming in different languages so that it brings it all together as such. For example, what is a class and how does it work etc. anyway here are some basic tutorials and links to different languages and kinder to show how they are kinder all linked . The different headings will have different languages links underneath ..
The classic hello world program examples for some programming languages.
- Flex – Hello world (flash swf)
- PHP – Hello world.
- Ruby – hello world.
- C++ – Hello world
- C# – hello world.
- Java – hello world.
Casting of variables
Flow control (loops) – while / for / foreach etc.
- Java – add two numbers
- Ruby – add two numbers
- PHP – add two numbers
- C# – add two numbers
- C++ – add two numbers
Comparison of classes
Delegates / Events
Overloading is when you overload a methods/functions within a class, when you overload a method you can define a function with the same function name but have either different return values and passing parameters.
Overriding functions allow for derived classes to override virtual functions from the base class.
Polymorphism allows for a base class to be inherited to create a new class that implements/add’s new functions. Here are some examples in different languages
Templates and Generics
Templates and Generics allow for the same class to be initialized with different data types. Here are some examples in different langauges
Constants, properties, fields, methods.
const in c++ ( and also within functions definitions) can be found here
Shall add more when doing the tutorials links
During a interview I was asked to do some “home work” coding to show my style of coding and if I was able to do the tasks.
- Exercise 1. (Simple)
Accept form input for a user registration form, and store results in a MySQL table, using PHP. Applicant should demonstrate a knowledge of input validation, and using server-side code to avoid sql injection exploits. The user data should include first name, last name, email, and phone number.
- Exercise 2. (Medium) –
Write a class containing 2 functions. One function to merge 2 or more images into a single binary file. Write a counterpart function to this,which can extract the original files from the single binary, and write them out as single images, using their original filenames. Compression is not necessary, as the exercise is only designed to show an understanding of using binary files with PHP, filesystem error handling, and planning a simple file format.
- Exercise 3. (Moderately difficult)
Create a simple stack-based calculator. This should be capable of performing addition, subtraction, multiplication and division. Example input would be: “2*(3+1)”. The result should be expressed as a numeric value, so the example should return 8. Usage of the eval() function, although amusing, is not allowed! This test is designed to show general programming skills, rather than an understanding of the programming platform; however the solution should be demonstrated using php as the language.