5 ms·
I have one: natural language programming. This exists. It's "Write each step of an algorithm in comments before writing any code, and (only when you're finish
by sillysaurus 14y ago
I have one: natural language programming.
This exists. It's "Write each step of an algorithm in comments before writing any code, and (only when you're finished writing each step in English in comments) fill in the code each comment represents".
But it's impossible to convince anyone to try that, though, even though it gives all the benefits you are imagining NLP would give.
The mentality "Don't repeat yourself under any circumstances, even if it adds no complexity and increases clarity!" is unfortunately why this is undiscovered. Also, people generally go overboard with the "commenting" part -- the purpose is to be pseudocode in the way Python is executable pseudocode, while retaining the ambiguity that is necessary for natural language to be natural. So it gets a bad reputation, and its power is hidden despite it being powerful.
- JBiserkov 14y agoSome Lispers have been doing something similar for some time. There's even a saying that "Any sufficiently well-documented Lisp program contains an ML program in its comments."
- klibertp 14y agoLiterate Programming - another 30 years old "technology". And it's good. As you say, the problem is not the tools, but rather mentality of rediscovering the wheel at best, and staying ignorant to the history of our field at worst.
- btilly 14y agoI have been known to do that. It is great for writing an initial block of code. It doesn't work so well 6 months later when you're editing that code.
- tspike 14y agoThe closest experience I've had to this is using RSpec and Capybara to do test-driven development. Here's an actual snippet of a test I wrote before writing the corresponding code for an app that's now in production: describe "adding participants" do context "when user has created a new event" do before :each do visit root_path click_link 'Get Started' fill_in 'Name', :with => 'Tres' fill_in 'E-mail', :with => 'tres@sogetthis.com' click_button 'Next' end it "should prompt for more participant info" do page.should have_field 'Name' page.should have_field 'E-mail' page.should have_button 'Add Participant' end it "shouldn't let you enter an invalid e-mail" do fill_in 'Name', :with => 'Tres' fill_in 'E-mail', :with => '#)(*)($*#)($*' click_button 'Add Participant' page.should have_content 'invalid' end end end It's been an absolute joy to work this way. I'd love to see this level of abstraction make its way into the mainstream in other languages and environments.