Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,239
(No sure where to post this, took a guess)
I recently had a code quality course at the university I am attending.
Through it I found some love for abstract code.
The idea of abstraction is to be able to understand how a piece of code operates without actually having to understand what it does.
It sounds confusing but it really is not.
Let's say I should create the following spell:
Deals 100 damage over 10 seconds to a single enemy unit.
Through abstraction it could look like:
All the details are hidden behind functions, which makes it way more readable and easy to find the part you are interested in.
While it would prevent some local usage, I think it is an underrated approach to code.
Never seen it done in wc3 modding, am I missing something entirely or?..
I recently had a code quality course at the university I am attending.
Through it I found some love for abstract code.
The idea of abstraction is to be able to understand how a piece of code operates without actually having to understand what it does.
It sounds confusing but it really is not.
Let's say I should create the following spell:
Deals 100 damage over 10 seconds to a single enemy unit.
Through abstraction it could look like:
JASS:
function onLoop takes nothing returns nothing
call LoadFromHashtable()
call UpdateFromHashtable()
call DamageUnit()
if IsDurationReached() then
call FlushHash()
endif
endfunction
All the details are hidden behind functions, which makes it way more readable and easy to find the part you are interested in.
While it would prevent some local usage, I think it is an underrated approach to code.
Never seen it done in wc3 modding, am I missing something entirely or?..