3 ms·
I like these type of things but I don't believe they are practical because of the massive potential variation within a single syntax which is typically hidden b
by duncanawoods 11y ago
I like these type of things but I don't believe they are practical because of the massive potential variation within a single syntax which is typically hidden by language specific culture, convention and idiom. When you transliterate from one language to another, the gulf is made visible and the resulting code is alien and unacceptable despite executing correctly.
The unavoidable problem is finding a language in which every one's solution to the same problem is the same but I think that goal is more likely provably false than possible. If it is possible then finding solutions in such a language might be like threading a tiny needle and too hard to use.
- logicrook 11y agoWell, you mean the Zen of Python's "There should be one-- and preferably only one --obvious way to do it." In any case, even then, people think in different ways: you can model a problem via category theory, geometry, algebra, and those would never translate into the same syntactical constructions, since the abstractions are of fundamentally different natures. Now I think mostly in a functional way, so my Python code is full of small functions to help write "pythonic functional code", e.g. the function iff(b,x,y) that returns x if b and else returns y. The resulting code could be translated algorithmically to a functional language in a very natural way; the internal def would be translated to where clauses, etc. The point being, I want to be able to think in the way that is the most adapted to tackle a problem, even if the code seems to be written in two different languages. This is no different from mathematics where each "X theory" is essentially its own language and each implies its own set of natural theorems.
- duncanawoods 11y ago>> This is no different from mathematics where each "X theory" is essentially its own language Nice connection between models and languages. The maths/physics discoveries achieved by using a new representation of a problem don't change the problem, they just present the issue at hand simply enough to be tractable. Each representation moves complexity trade-offs to a different category of problem. I guess that does say something in favour of automatic syntax conversions but it seems too low level. Maybe conversions between the mode of abstraction being used is where it gets interesting.
- logicrook 11y agoIn mathematics, there are fairly few such 'meta-results', and each one is duly celebrated as impressive; the one that comes to mind is Curry-Howard correspondence... but in more 'traditional' maths, it's very hard to find general high-level translations. There are many cases where automatic syntactic low-level constructions can bring huge improvements, in compiler design, etc, it's more that they are less susceptible to be directly useful to laymen.
- alehander42 11y agoThat's correct, I made it because I wanted to illustrate an idea. However I think it can still be useful, and already there are precedents: semi-visual languages with underlying text source, lisp bi-directional macroses. Do you think my another hivemind idea can be useful? Regrouping code based on structure and intent (e.g. Group source by class / by method / in groups of highly-connected components)
- duncanawoods 11y ago>> I think it can still be useful, and already there are precedents I have used some of these precedents so I guess I know their limitations. I have used and loathe visual languages (Ladder logic, Labview, Simulink) and consider them to be a dead-end that attracts too many people just because they are pretty. I have created and used one-way code visualisation tools which can be occasionally useful. They however have many degenerate cases where the automatic visualisation of fairly simple code is totally unreadable for me to believe there is much value in reversibility. >> Do you think my another hivemind idea can be useful? Regrouping code based on structure and intent Possibly. I use a few automatic tools for querying code and structure which are useful but given they lose the "designed to be understood" feature of hand-crafted information structure, they are only limited support tools to help solve specific problems. For example to get a handle a new huge code case, I use doxygen to create call-graphs from static analysis and profilers to create call-graphs from dynamic behaviour. Things like stats of hit-counts on various parts of a code-base can teach you a lot in seconds that is hard to grok from just reading code. I believe that creating content for communicating understanding is a huge design challenge. Its really hard when its just 1000 words of text or a small UI but when its a 1M loc code-base its a gargantuan challenge. The fundamental conceptual break down, modularisation, choice of interfaces etc. is what distinguishes good codebases from unmaintainable ones. I don't see a code base as a sea of facts which you can understand with query tools. IMHO "designing to be understood" is a greater challenge than "designing to work". I would be excited if you were thinking of a tool that could say analyse connectivity within and across modules and identify alternative high level structures that would simplify an architecture for human understanding. It feels like a graph clustering problem within the realm of modern data analysis.