Home>

I have a question about how to stream the process.
One is to process [1] [2] [3] in the object.
The other is to judge the result by the controlling class
How to execute [1] [2] [3].

Flow method: 1 allows the calculation result of the data to be deep in the function.
(From the creation of the execution result to the judgment of normality/abnormality is performed in the object)
How to flow: 2 can get the calculation result of the data immediately, but control
I think that it will be a burden to judge the calculation result for the class i am doing.

Which is normal in the case of repeated processing? Is it mainstream?
(Isn't it better to have a deep place where normal abnormalities occur?)

* This time I wrote it in Python, but other object languages ​​are also acceptable.
We would appreciate it if you could give us a reference opinion.

(Example)
Class class Sweets_table
    zenkoku_total = 0
    chihou_total = [] // list
[3] sweets_zenkoku_total ()
        for j in chihou_total:
            zenkoku_total + = chihou_total
[2] sweets_chihou_total (ken_total)
        for i in ken_total:
            chihou_total + = ken_total
[1] sweets_ken_suryou (ken_total)
        sweets_chihou_total (ken_total)
        return

How to sink: 1
Class Sweets_dish
        ken_total = in_data
        st = Sweets_table ()
        st.sweets_ken_suryou (ken_total) [1] [2] [3]
How to sink: 2
Class Sweets_dish
        ken_total = in_data
        st = Sweets_table ()
        st.sweets_ken_suryou (ken_total) [1]
        if st =='success'
            st.sweets_chihou_total (ken_total) [2]
        if st =='success'
            st.sweets_zenkoku_total (ken_total) [3]