Learn Programming through Logical Thinking Series – 12
This blog explains about Learn Programming through Logical Thinking Series – 12 and is given below :
_______________________________________________________________________________
Hi Guys,
Logic in programming is a fundamental key to be a good developer. Maybe, depending of your job place you are going to use more algorithms or not. If you are a web designer probably you are not going to deal with complex algorithms, but if you are front-end developer maybe a little more and if you are a back-end developer much more.
1.- Think to solve
Programming is about solving problems, a good tecnique is to split the big problem in small ones to focus on each problem in a better way, you can use pseudocodes in a program or in a simple paper.
2.- Practice
The most important point is this: practice. An algorithm is nothing more than an ordered and finite set of operations that we carry out for the sole purpose of finding a solution to a problem. So try to practice simple problems to get a better logic.
3.- Learn about Data Structures and Algorithms
Learning about structures will give you a better plan to focus your problems and have an efficient software. You can play games like Chess and practice Mathematics.
4.- Learn programming paradigms
A very good point is to learn programming paradigms. Probably one of the most programming paradigm is the The Object-Oriented Paradigm (OOP). A programming paradigm is like a blueprint to follow to create our projects. You can learn Functional Programming to learn how you can develop programs and solve problems in a different way.
5.- Look at other people’s code
In programming we have many ways to solve problems, maybe another person solved the problem that you have in an optimal and simple way. Looking at other people’s minds is essential to advance as a programmer.
In this post, our intention is to create Z Pattern (see below). Already in our previous posts, we learnt X and Y Patterns. Here our focus would be on creating the below pattern.
package pattern.aug;
public class ZPattern {
public static void main(String[] args) {
// TODO Auto-generated method stub
//1st line
for(int i=0;i<5;i++)
{
System.out.print(“*”);
}
System.out.println();
//2nd line
for(int i=0;i<3;i++)
{
System.out.print(” “);
}
System.out.print(“*”);
System.out.println();
//3rd line
for(int i=0;i<2;i++)
{
System.out.print(” “);
}
System.out.print(“*”);
System.out.println();
//4th line
for(int i=0;i<1;i++)
{
System.out.print(” “);
}
System.out.print(“*”);
System.out.println();
//5th line
for(int i=0;i<5;i++)
{
System.out.print(“*”);
}
}
}
Output:
_______________________________________________________________________________________
REFERENCES :
https://hackernoon.com/5-points-to-improve-your-programming-logic-23c8bbafe8d2