Slapping the finishing touches on the New / rewrite of the Witness script.

in steemegg •  2 years ago  (edited)

It took a little bit of time to get into the groove, however I shifted from Javascript over to Typescript .

The two are the same except one key difference... as you can assume Types.

In javascript your free to do as you wish , typescript allows you to set rules around What each piece of data in the system is supposed to be.

For instance in javascript I might say

ProcessVote(author permlink weight)
its up to me to make sure the value stored in the upvote variable to be correct.

in typescript it would look something like this

ProcessVote(author: string, permlink: string, weight: number)
this is gibberish but the key takeaway is those little identifieers to the right of the variables.

in javascript it will allow me to pass those numbers backwards... Only revealing the error once the program breaks.
Typescript start the program if any variables are passed incorrectly anywhere in the program so its very helpful longerm.

This is very stressful when theres hundreds even thousands of little functions to check this person see if that person got voted yet, or if the post is old enough so on so forth...

It esentially forces you to write cleaner code, as the computer is able to run validation when im writing the code to ensure everything is recieving the right dataTypes etc.


Long story short, I will be switching this on shortly, and hooking the website back up to it... that way no loose ends are still hanging... Once thats complete I will make the edits i had planned for Paid voting ... in Typescript... And the rest will be history!!!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

image.png

Heres a free vote on behalf of @se-witness.

@steemegg hope you are doing good in life, I am the founder and owner of nftmc community on steemit. I need Little help and time of your to discuss regarding a project. Do you have discord/email, Or were can I contact you. Thankyou. 🙏