On Thu, Mar 30, 2017 at 5:04 PM Marc Hanisch via Pharo-users < pharo-users@lists.pharo.org> wrote:
> Hello, > > I have a question which is more related to software engineering than to > Pharo, but I hope that someone can give me an useful hint ;-) > > > Thanks for any advice :-) > Marc > There are three schools of thought Static programming , Dynamic programming and Hybrid Programming *School of Static Programming * The school of Static Programming which has been originating from compiled languages (turn code from source code to machine code before execution) it follows a static approach to the code. This means everything is clearly predefined, planned ahead and follows strict rules. *Pros: * 1) because compilers have specific code that its intentions are clear its much easier for them to optimize performance, hence code tends to run much faster eg C code tends to be 100s to 1000s times faster than Python code 2) Certain bugs can be captured at compile time which makes code safer to deploy to client. The compiler usually can capture such bugs and display relevant warning and errors again because the compiler is more strict to what goes in and what gets out. *Cons:* 1) Changing code on the fly, while the code runs can be notorious hard to do because of these restrictions. This means it does not work well with coders that love to experiment and try new ideas on the fly. 2) Finding bugs also can be harder because of these restrictions, the coder cannot easily change code on the fly on execution and generally the programming language is much less forgiving not only when coding but also when trying to inspect code and debug it. 3) Overall design can be quite ugly in the shake of increased performance and safety and that may affect the design of code as well *School of Dynamic Programming* The school of Dynamic Programming originates from interpreted languages , though modern implementations have compilers that compile source code to byte code and an interpreter that converts byte code to machine code on execution. There is no need for planning ahead in dynamic coding, instead dynamic coding works on the basis of abstractions and its proud to be the father and mother of OOP. OOP is an abstraction based , dynamic coding workflow that dominates dynamic language and even modern statically compiled languages. *Pros:* 1) Code can change on the fly making coding much easier and beginner friendly 2) No need to plan ahead 3) more dynamic workflow also when debugging code that allows to interact and communicate with code real time *Cons:* 1) Performance is sacrificed, thats not obvious for code that executes at once but for code that repeats thousands to millions of times the slow downs depending on the implementation of the language can be anywhere between 10s of times to 1000s of times slower that a static language 2) Using the wrong data / object will not be easily reported beforehand and at times it can be hard to detect such problems. Other bugs can also be hard to be detected even under the use of helping tools that examine and evaluate code because of the generic nature of the code. *Hybrid Programming* Even though static languages give us static programming outside the box and dynamic languages give us dynamic programming outside the box, modern implementation allow for repetitively easily to mix these two workflows. Its also possible for the coder to implement his/her own features with a language. For example C language does not support OOP outside the box, but OOP implementations for C do exist most popular being GObjects used by the GTK+ library C++ and Java although statically typed languages support also more dynamic types through the use of templates and generics Dynamic languages also can come with a variety of tools that perform checks during runtime or even compile time. Also test driven development is very popular for performing this task allowing the coder to create code , launch with a single command thousands of tests and make sure his code passes even more strict guidelines than an average compiler for a statically compiled language. The catch however is that in both cases there are compromises, sub standard implementations and plain weird behavior. *Summary:* *There is no right and wrong, whether we talk about types or other features whether you will follow the dynamic school or the static school is up to you and you preferences.* Both approaches have pros and cons and both will make you waste time while coding. The future however looks more bright and promising for the dynamic school with the rise of AI. Compilers and developer tools in the future may be smarter not only detecting errors and common bugs but actually analyzing coder intentions and even coding philosophies. AI is already used for code analysis but its still on early stage but is none the less our very close future. Funny irony: The most popular scenario for future technology is quantum computing. Hardware by nature is "static" , you have to design it before hand and make sure it works almost perfectly before selling it. This is reflected to the basis of digital architecture where the smaller unit is bit which is always a number and always either 1 or 0. But with quantum computing the bit can inherit quantum properties and be both 1 and 0 at the same time. This will allow in the future for more flexible design of "dynamic" hardware allowing for hardware to also deal with abstractions directly.