|
|
|
|
|
by layer8
810 days ago
|
|
In my experience it’s not exactly trivial to validate code you didn’t write yourself, because you have to think through it in similar depth to when you write it yourself. While on the one hand you save the time of coming up with a solution, the task of merely verifying an existing solution is also more tedious, because it isn’t intermixed with the problem-solving activity that you perform when writing the code yourself. There is an increased risk to fall for code that looks correct at first blush but is still subtly wrong, because you didn’t spend time iterating on it. It doesn’t seem plausible to me that you would save 90% of the work, unless it’s boiler plate-heavy code that requires only little analytical though. |
|
That is why I design the language the way it is. You must define each step you want to happen in your application. Lets take for example user registration, it looks like this
--- plang code ---
CreateUser
- Make sure %password% and %email% is not empty
- Hash %password%, write to %hashedPassword%
- Insert into users, %hashedPassword%, %email%
- Post, create user in MailChimp, Bearer:%Settings.MailChimpApi%, %email%
- Create bearer token from %email%, write to %bearer%
- Write %bearer% to web response
--- plang code ---
That is an executable code in plang. It's easy to read through and understand. You need to have domain knowledge, such as what is hashing and bearer token. You are still programming, just at higher level.
Validating what will execute, you need to learn, just like with any language, but it is relatively simple and you start to trust the result with time(at least I have)
Compared to the 130 lines or so of code in C# for the same logic, https://gist.github.com/ingig/491ac9b13d65f40cc24ee5aed0408b... That´s about 95% reduction of code, and I see this repeatedly.