Read Mode
Default

Dynamic Vs. Static Programming | Advance Batch Concept | By Kvc

Dynamic Vs. Static Programming | Advanced Batch | By Kvc
The Two Methods of Making a Program | By Kvc

Hey Hello Guys! #TheBATeam is Back with another Topic related to Batch programming. This time we'll Discuss the two main methods of making a Program in computer programming. Although these are not the technical / official terms. These terms arise in my mind, when I was in toilet (enjoying morning refreshment). I was thinking about the change in my Programming style from the first day to today. And I noticed alot of change in the way I write code. The improvements in the coding style are because of past experience with Batch.

Few of the characteristics that I thought about both the methods. I think they are valid up-to quite a large extent. If you are not agreed or want to add anything. Please make your statement in the comments Below.


Sr. #
Static Programming
Dynamic Programming
1.
Choice of Beginner programmers
Choice of Advanced programmers
2.
This method makes the code Rigid.
This method makes the code Flexible.
3.
Length of the code remains less.
Length of the Code becomes more.
4.
Difficult to change program’s output.
Easy to change program’s output.

The Example
The Big change in my programming style was that, I have learnt to Protect sensitive data dynamically. No one can easily access that private information. So, Lets talk about these two terms in detail. Let us take a situation that you need to make a Simple Login Screen with Batch. The screen will ask you only for a Password. So, The Code can be written in Two Ways. The First way is Static programming and Second Way is Dynamic Programming. 

Note: You can't Copy the Code from this page directly, As 'Text Selection' is disabled here. But you can download the test files From the Download Link given at bottom of this article.

Lets look at the First method, i.e. Static Programming method.
________________________________________________________________

@Echo off
Cls
Echo. Please Enter Your Password here:
Set /p Password=
If /i "%Password%" == "TheBATeam" (Echo. Access Granted!) ELSE (Echo. Access Denied.)
Pause >nul
Exit /b
________________________________________________________________



As Now, you have Understood, what the code wanna say. Lets have a look at the Second method, i.e. Dynamic Programming method.

________________________________________________________________

@Echo off
Set /p _Current_Password=<"Data.txt"
Cls
Echo. Please Enter Your Password here:
Set /p Password=
If /i "%Password%" == "%_Current_Password%" (Echo. Access Granted!) ELSE (Echo. Access Denied.)
Pause >nul
Exit /b

________________________________________________________________


The Explanation

And now if you go back to the table I've created above and compare the conditions with these codes. You'll find out that they are completely valid. And it is very easy to understand what the Static Programming Code is doing. It is taking a simple string from user and comparing it with a static string within the Batch Code. So, Our Password will always remain the same. i.e. TheBATeam.

But, In the Dynamic Programming method. You've noticed that the Number of lines in more. And this is due to the reason that we are reading the current password from a Text file, which is acting as the Database for our program. And apart from doing the same work as the first code. This method provides us some additional advantages too.
  1.  You can now change your password at any time, or with other program. Just need to change the text in the Data.txt file. And you have changed your password successfully.
  2. Data security. Now, no one can directly open the source and find out your password. And you can lock / hide this Data.txt file for everyone's access to secure your password more.
  3. If in case, you need to change the password manually. Then, You don't need to be a programmer to do so. You can simply modify the related file in the Database and changes will be applied to the program.
Please watch the video Embedded below this paragraph, to understand the 3rd point more thoroughly. When this thought of 2 methods came to me, I thought I need to share it with all of you guys. So, that you and I can learn more from this article's interaction.


I think that all of the explanation and thoughts have been written in the article. Now, Its your turn to make comments and let me understand your point of view. Thanks for your time and support. Download the Related files from the Link Below.


Keep Learning, Keep sharing...
Be happy, Spread Happiness...

Download Link:

#TheBATeam

No comments:

Powered by Blogger.