Does Sup Forums write clean code?

Does Sup Forums write clean code?

Other urls found in this thread:

duckware.com/bugfreec/index.html
en.wikipedia.org/wiki/Clean_(programming_language)
doc.ic.ac.uk/~susan/475/unmain.html
twitter.com/SFWRedditVideos

Yes, always.

REEEEEEEEEEEEEEEEEEE

Of course, by my own definition of 'clean', not the one of that memester.

>clean code
>"reading few jumps and multi option procedures is too hard for me"

>not the one of that memester
How does it differ?
That book gives pretty consensual advice.

You're like those C retards that answer calls for guaranteed memory safety by "just code better".

Expressiveness is an inherently finite resource, wasting it because you can't be arsed to do some architectural work that will help you down the line is hardly the best way to go about things.

wanna know how I know you're fat?

...

Bob Martin is a gigantic piece of shit.

Depends on if it is a dirty script for myself, or some code for an open source project or as part of the codebase for my job.

I bought that book and never read it. Like so many others.

Nigga I'm paranoid. If w3c validator shows a single warning in HTML I immediately correct it. If Visual Studio has a single warning I immediately correct it.

Yes, because of code reviews

It's obviously packaged in a way to shake money from you suckers - called degrees. Like a methodology talk.
The actual content is either obvious stuff - at least it's pretty obvious to me, but then again I have the X300 phsychoprogrammical self reflective impropability drive - or stuff that harms the source code when overdone.

duckware.com/bugfreec/index.html

Lots of books about clean code.

Visual Studio bitches at everything. I am just waiting for when it throws a warning that the program you just typed up is not compatible with the current windows version. /s

>code reviews
What did he mean by this?

Don't worry about it - only happens to people with jobs.

Safe then.

N
O
T

ARGUMENT
N

>He doesnt oneline it

This.
>dirty script
Throw in a few jumps here and there, somewhat ugly code.
>open source project
Spend days reconsidering variable names
>job
Use randomly generated variable names and otherwise obfuscated code, keep documentation and the real names on my phone. Good luck firing me now.

My code is so clean it doesn't even exist

>python spacing

top bait

void stringStutter(string s, int length){

for (int i = 0; i

Determine what s.length() is and place it in your for condition. Execution will be faster

I want this.

You stole this from the other thread, thievo.

> Still using cases instead of maps

Not him, but to do this would be to store it in a temp variable no?

Is that the only overhead for the increase in execution time?

...

I have seen some powerful, highly paid tech gurus that only write shell scripts and regex.

You think you are joking, but...

What is the cleanest language

Half of Sup Forums shills C, and writing clean code in C is pretty much impossible for things more complex than fizzbuzz, so probably not.

What cute font is this?

>Implying
cat-v.org
The only way to write clean, simple software is C

Have you ever looked at vim's source code? Or any big C program, for that matter? It's always either spaghetti code or a poor attempt at emulating OOP.

>vim
>big C programs
>proper C
Any good large software should basically just be small software joined together, like the UNIX philosophy
I know that it's not like that in practice, because people seem to think bigger is better, but it should be

Profont

What about the Linux kernel? I honestly don't know, how bad/good is it?

"Clean" is a very vague term, but I'd say C# is up there.

Lua

I've only heard it describes as 'its okay'

en.wikipedia.org/wiki/Clean_(programming_language)

kek

vb6 is quite clean t b h

>not defining static variables with the switch/case digits in them

10/10

the problem with this code is vim, who doesnt have indenting for wrapped lines.

Not really. I'm trying to improve though.

Reminder that -Werror is almost always justified

Rate my fibonacci:


public static void main(String[] args) {
fibonacci(10);
}

private static void fibonacci(int nth) {
fibonacci(nth, 0, 1);
}

private static void fibonacci(int nth, long first, long second) {
if (nth == 0) {
return;
}
System.out.print(first + " ");
fibonacci(nth - 1, second, first + second);
}

I don't write code using functional languages,
so yes - I do write clean code

>writing clean code
>not writing unmaintainable spaghetti code so no one else knows how it works
>job for life as the company is too scared to fire you

doc.ic.ac.uk/~susan/475/unmain.html

>mutation
>clean

I've worked at a company that still had a 1980s mainframe and the most incomprehensible code known to mankind, all maintained by a single unfireable engineer who designed the system, it was literally like an IRL version of Dilbert

> Using costful abstractions where isn't needed

>Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result in a database.
>If, for example, you were writing an airline reservation system, make sure there are at least 25 places in the code that need to be modified if you were to add another airline. Never document where they are. People who come after you have no business modifying your code without thoroughly understanding every line of it.

Kek this is some evil shit. I'll read the whole thing later.

Pro tip: remove the calls to Sleep for blazingly fast execution speeds

This. I use random variable/function names and remove any comments I come across. All the documentation (including the real names) is on my phone.

Use code tags for the love of god.

Trying to keep it at one level of abstraction per function can be bothersome.
Also his absolute hardon for splitting EVERYTHING into tiny functions be too zealous, and sometimes detrimental to code readability - IMHO.

Pretty terrible. Have to actually read the code to understand what the function does. And then it turns out that it has two responsibilities instead of one.

Read the book user.

I never had the privilege to work on my own project from scratch.

Instead I just inherited a project in "just fuck my shit up" state, full of deprecated and outdated methods and functions, and legacy code you know you can't delete because something just MUST depend on it.

it is also full of comments like "please do not use this :(" and "warning! this method contains shitcode and evil js giving no f#cks about this and that doing out-law gangster sh#t".

Cut my life into pieces.

Looks better than my code. But I'm coding alone in my company.

Have fun tweaking my code after I change jobs.

Randomly generated variable names
Using that from now on.

My condolences for the loss of your sanity.

>Pretty terrible
the task is to print the nth factorial
how would you have done it?

Bonus points, use a wordlist to generate variable names like pointerFunctionInstanceHandler.

No. And then yes.

best formatting style coming through

kill

i designed our buildsystem in a way that forces our devteam to not submit stupid hacks unnoticed and forces them to produce somewhat clean explainable code

i myself obviously work not always in the constraints of this system and produce one unmaintainable badly named hack after the other some days if i know its "run once then throw away" code

clean code is for long term projects/libs or for people you dont trust to know when a hack is necessary/acceptable and dont trust their ability to produce a good hack/code in general

What happens if one line is too long?

you redesign your code until it fits.
if you have to you change the spec.

why not simply switch to python?

Kek this is going to drive someone real nuts.

>curly in same line as function header
>indenting cases
kys

Haskell

cat -v is just the "we're edgy Atheists" philosophy website. The website that's actually about programming is suckless, and yes, it's breddy gud.

Not with GCC and glibc since optimization flags actually trigger some warnings such as Wunused-result (try it with fgets and -Os). GCC is a hell of a piece of shit.

>Have to actually read the code to understand what the function does.
lol?

>Not using prototypes

fire you? they are going to sue you man.

I don't follow any sort of "style" dogmatically. In general yeah, I try to make sane architectural design choices that won't make the code an unmaintainable clusterfuck. It's very easy to go far overboard with "extensible" and "clean" code while following some dude's rules blindly in my experience.

Basically you should use common sense in regards to the program you're writing and its requirements, any decent programmer with some experience should be able to do this. If you're new you should try to pick up some good practices, but always think about what you're doing and don't apply any sort of rule blindly if it doesn't make sense to you. If you're in that situation it can only mean 2 things: you either don't properly understand what you're doing or the rule is retarded in the specific scenario, as such you should think about it some more.

My code is so dirty. I always have to shower after coding or seeing my own ...

Absolute madman mode:
Have an object named after something that should be a function
Have a variable named after something that looks like an argument
-> instead of using varSomething, use GetWebsiteInterfaceHandlerFactory(clientReference)
Also, use Il1| O0 ,. '` similarities in these and have the """""functions""""" change """""return value"""" from their """"arguments""""" periodically.

I'm not doing anything illegal. Besides, have fun paying for translating my notes.

>I'm not doing anything illegal
yeah you are people get sued for this all of the time. i don't care, personally, but FYI if you work for a company that can afford lawyers they will take legal action against you if it comes to that

That book is extremally exaggerated, and it's basically "Coding in Java".

Maybe in the USA.

The task is to print the first 10 fibonacci numbers.

public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
System.out.println(fibonacci(i) + " ");
}
}

public static int fibonacci(int n) {
// calculate and return the nth fibonacci number
}


If you're worried about this having worse time complexity, memoize the previously calculated values.

Do you not think that's a serious problem?

>agile.
>JBGE
there ya go

>people get sued for this all of the time

elaborate

>if (nth == 0)
nth

not recursive
not memoized

Common Lisp
Then
Scheme or Guile

Guys. This book is not for you. It is for poo in the loo Pajeet dumb fucks. If we seriously want to advance the state of software security software must not become easier but instead absolutely trivial. It is the only way to prevent the IOT botnet apocalypse.

Ada SPARK

Get thee behind me Pajeet.

It compiles down to pure functional SSA anyway so what's the problem?