Skip to main content

How to do Effective Programming?

There is no secret to doing effective programming but following a sequence of steps and procedures can help in building great programs. Today I will take you on a tour to some of the best practices that are integrants of perfect programs.

Algorithms are important: - You can’t deny the fact that algorithms are important and before start to write any program, Algorithms are must to write. For example, if there is a program about finding the sum of two numbers? What will you write ?The steps can be :-

1)  Get the first number.
2)  Get the second number.
3)  Add both numbers.

This is what algorithm is writing about ,a list of statements .From the above three statements you can conclude boundary cases (at least two number should be there in input), mathematical function(Sum is needed here) , storage capacity(amount of memory to be assign to the variables), number of methods by analyzing repeat steps (reduce replete codes) and many other things. During algorithm only you can build a solid idea about how your code will work and where it will fail. You can handle exceptions and many other things. Writing in simple language will help in starting up. Even for small programs please write an algo.

Pseudo Codes are the base of a program: - This is different from algorithms. Once you define everything on paper, you are ready to write pseudo code. Do not think about syntax in this step, just start writing your code for example:-

Input:-( You can define boundaries like A & B >0 or A & B is must and present , A & B can’t be decimals or any other thing)
A=15;
B=22;

Output:-
C=A+B;

This will be enough , it is important to note down what is coming and what is going? In middle everything is programming.

Input -> do some stuffs -> Output

Programming language is a material for the program:- Once you have written a code you can go for choosing a programming language that suits your problem statement. It can be based on memory , based on syntax , based on technical skill or based on anything. For example, if you choose java.You should know how java works and what is correct syntax.

Test Cases is like painting a program so that it looks better:-
Once Program is written in any of the language , next step is to check for the right results. If there is a bug for half of the test cases and for half it is working there is no use. If a program is working independently but not as a combined again there is no use.

The best technique to finish up your program is running through it with several test cases. Think about all the scenarios... where the program is in use  and run every corner of it. Whether it is about checking with some odd values or checking it with an infinite list of values.

See where it is breaking ? how much time it is taking to solve the problem? Where it is fast ? where it is slow? Which kind of situation is it favoring? where it is not? For me, this is the most sensitive steps that need to take care of with focus.

If you find any improvement go back to the first step and repeat until you get the best solution.

Hope you find a good answer from above notes, in the case of any doubt please drop me a comment .You can also follow to this website for other tutorials and future tips.






Comments

.

Popular posts from this blog

Solved: com.microsoft.sqlserver.jdbc.SQLServerException: The index 1 is out of range.

This error usually comes when we try to insert data in a query where there is no index defined for it. Example :- String strQuery=“select * from location where city_id=? ”; The question mark will be the the first index if we want to insert data so if we call a function like- oPreparedStatement = oConnection.prepareStatement(strQuery); oPreparedStatement.setString(1,235); here we are sending 235 as a first parameter so it will work fine but as soon as we write something after it like oPreparedStatement.setString(2,”kanpur”) then it will throw “The index 2 is out of range” since there is no place to send this value in a query hence it will throw the same error. Here index defines the parameter for which there is no place in the query. To rectify this we need to write query like- String strQuery=“select * from location where city_id=? And city_name=? ”; then it will work fine. The cases in which these errors can occur is- 1)Query is co

Career in software engineering : Roles to know

when someone starts a career in software engineering there are plenty of options. Although most graduates have the same degree, everyone starts in a different role. Developer / Coder - Engineers in this role get a chance to actually implement and write software. At the start of a career mostly it is about fixing defects in existing software then taking small changes to the software and eventually getting to the point to handle and implement more complex changes.  Quality analysts / Quality engineers - Engineers in this role test and automate software. This is a challenging role where one has to know about the full functionality of the software and test accurately so the software built is of high quality. This role also involves the automation of test cases and preparing a test suite that can be run and detect issues automatically. Release Engineers - Once the software is built and tested release engineers are responsible for pushing a set of code to production. A production is a plac