How to write a clean code – 6 Tips

This is a tiny post which talks about writing a clean code for a fresher who is trying hard to get success in the IT Industry.

1) Use the meaningful variable names

example
$elapsed_time_in_days;
$days_since_deletion;

2) Adding comments is one of the good habits. write comments for every code modifications.

3) Code scouting – When picking up the new code from the Internet, Take some time to read it and try to add methods or split the required functionalities.

4) Functions and sub-functions. Make sure functions are doing its job that its meant to do.

5) Testing – Unit testing is very important, testing the functionality and isolation intensively.

6) Final tips are Practice, Practice, Practice.

Goog Luck!

What is bitcoin?

Bitcoin is a worldwide cryptocurrency and digital payment system called the first decentralized digital currency, as the system works without a central repository or single administrator. The system is peer-to-peer, and transactions take place between users directly, without an intermediary. These transactions are verified by network nodes and recorded in a public distributed ledger called a blockchain. Bitcoins are created as a reward for a process known as mining. They can be exchanged for other currencies, products, and services.

In simple bitcoin can be explained as below,

Bitcoin is a type of cryptocurrency in which balances are kept using public and private “keys,” which are long strings of numbers and letters linked through the mathematical encryption algorithm that was used to create them. The public key (comparable to a bank account number) serves as the address which is published to the world and to which others may send bitcoins. The private key (comparable to an ATM PIN) is meant to be a guarded secret, and only used to authorize Bitcoin transmissions.

Here is how a bitcoin transaction is processed:

1) Payers initiate a bitcoin payment using “wallet” software.

2) This and other pending transactions are broadcast on the global bitcoin network.

3) Once every ten minutes or so, “miners”, specialised computers (or groups of computers) on this network, collect a few hundred transactions and combine them in a “block”.

4) In order to mine a block and validate the transaction, miners compete to solve a difficult mathematical equation (a “hash function”). The miner that solves the equation first further processes the block and broadcasts this “proof-of-work” to the bitcoin network.

5) The other miners check the proof-of-work and the validity of the transactions. If they approve, the winning miner gets a reward of 25 newly minted bitcoin (about $9,800/bitcoin at current prices), which is the incentive for miners to provide computing power. Adjusting the difficulty of the puzzle ensures that the supply of new bitcoins remains steady.

6) The mined block is added to the “blockchain”, a big, unbreakable ledger that lives on the bitcoin network and serves as a record of all transactions.

7) The payee can use his wallet software to see whether the bitcoin have arrived.