[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/prog/ - Programming

Programming board

Catalog

8chan Bitcoin address: 1NpQaXqmCBji6gfX8UgaQEmEstvVY7U32C
The next generation of Infinity is here (discussion) (contribute)
A message from @CodeMonkeyZ, 2ch lead developer: "How Hiroyuki Nishimura will sell 4chan data"
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 1 per post.


File: 1430182741328.png (221.57 KB, 500x500, 1:1, plan.png)

53e03d No.2289

Sometimes the argument will be made that "Language X isn't bad, it's just easy to write bad code in" or some variant.

Are there any languages which practically force you to write good code?

601dfc No.2290

Well, Go is designed in a way that makes it harder to write some forms of bad code.


861286 No.2292

That would require some notion of what good code is - which depends on the context. That is, the language. It's possible to attribute some objective properties to good code. But the lion's share of it is subjective and unquantifiable.

It's a rather circuitous argument at that point. The language forces you to write good code within that language's context? I mean… that's what all languages strive to do.

This has a necessary corollary that you should just seek the language/context that fits what you see as good code.


493ccf No.2295

>>2289

What I'm still missing is a feature to tell the compiler what subset of the language can be used in application code and in library code.


e390e5 No.2297

So let's suppose that there are no inherently bad languages and consider a language which gets bashed often, like C++.

If /prog/ agreed on a "good" subset of C++ and a style guide, and then wrote a compiler obeying the rules of /prog/ C++, would this be a "good" language?


bdfb56 No.2298

>>2289

>Are there any languages which practically force you to write good code?

Scratch, maybe?

>https://en.wikipedia.org/wiki/Scratch_%28programming_language%29

Even there though, I'm sure it's possible to write bad code.

>say H

>say e

>say l

>say l

>say o

>…


cb8715 No.2300

>>2297

Good subset of C++: space, newline, semicolon.


3ad59e No.2310

>>2289

Ada?


770501 No.2319

>>2298

>say H

>say e

>…

Perhaps a good general rule is that a function shouldn't be called twice in a row. Although then there's the matter of detecting:

(in pseudocode)

define sayH as "say H"

define saye as "say e"

sayH

saye

>>2290

>>2310

What sorts of things do these languages force you to do/prevent you from doing?

>>2300

Insert other languages where I said "C++".


067c9b No.2453

Perl because it's too convoluted to just try some random things and see if it works. You need to understand it to a relatively high degree to write it.


d32f6a No.2466

>>2289

Haskell, usually won't even compile if you write some types of bad code.


b9d5db No.2475

>>2319

Rob Pike made Go a higher level version of Plan9 C, presumably he wanted to prevent low level C spaghetti and overengineered C++ on insanity. It also comes with a tool that autoformats code for you, which I guess is more cosmetic.


7a5bfc No.2476

>>2466

>the Haskell enforces good code meme


86acf4 No.2507

>>2297

C but with classes


78535a No.2512

>not using Ada


a0b5e8 No.2515

So after about a month, people's justifications for various languages have been:

Perl - Forces you to know what you're doing because otherwise you're fucked

Go - Forces you not to write spaghetti or C++-tier code

Haskell - Forces you to write code that compiles :^)


fd54e7 No.2808

Haskell… most of the bad code is rejected

Scheme… you have to try really hard to do it


000000 No.2831

Python forces you to use good indentation practices.




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]