Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "use braces"
-
Today I learned how to use curly braces in Python for those coming from C style programming languages. I love that this was the accepted answer.10
-
First day at new web dev job:
Me: what IDE do you guys use?
Coworker: Notepad/notepad++
M: Okay... Any version control?
C: Oh we don't need it. We just update the server pages.
*Boss walks in*
Boss: Heres the project for you to do just need you to rebrand this web app we made for client A for client B just need to change some scripts. Should only take afew hours.
I take a look. No comments. Not formatted. Missing braces and brackets. Semicolons at odd places and missing at others. 7802 lines of code...16 -
I fucking hate python and myself even more. Python is easy they say, Python has nice syntax but fuck you . Fuck you seriously I cringe if I see non-c-like syntax. Every time I leave my comfort zone I get fucked over by damn semicolons. Fuck this imports i don't know your damn library. But god damn In far too advanced for hello world. There are two versions and the lib I want to use is incompatible? Well fuck me? That kind of shit never hit me on PHP. Damn me! Fuck you python. I want to know you but you fuck me harder than life. GEHÖRT? DU FICKST MICH HÄRTE ALS DAS LEBEN DU HURENSOHN!!!!
What is even your problem? Indentation? Well thank you for not having braces! I mean come on I try, I really do. I know you are different but every thing I want to learn about you is either for uber beginners or so advanced I don't even know what's going on. Do magical shit in a few lines? What the fuck is in those packages? A wizard full filling whishes like "plz make this work"?
But don't worry you cum snorting unicorn as much as I hate you I'm more mad about me for not being a descendant of fucking slytherin!16 -
So we had a dev on our team who was on a performance improvement plan, wasn't going to pass it, but decided to quit before it was over saving us 2 weeks.
I was ecstatic when he left (caused us hell). I knew updating his code wouldn't be great, but he was only here 6 months
"how bad could it be" - practiseSafeHex - moron, idiot, suicidal.
A little run down would be:
- Despite the fact that we use Angular 2+, one of his apps is Angular 1 ... Nobody on the team has ever used Angular 1.
- According to his package.json he seems to require both mongoDb and Cloudant (couchDb).
- Opened up a config file (in plaintext) to find all the API keys and tokens.
- Had to rename all the projects (micro services) because they are all following a different style of camelcase and it was upsetting my soul.
- All the projects have a "src" folder for ... you know ... the source code, except sometimes we've decided to not use it for you know, reasons.
- Indentation is a mess.
- He has ... its like ... ok I don't even know wtf that is suppose to be.
- Curly braces follow a different pattern depending on the file you open. Sometimes even what function you look at.
- The only comments, are ones that are not needed. For example 30+ lines of business logic and model manipulation ... no comment. But thank god we have a comment over `Fs.readFile(...)` saying /* Read the config file */. Praise Jesus for that one, would have taken me all week to figure that out.
Managers have been asking me how long the "clean up" will take. They've been pushing me towards doing as little as possible and just starting the new features on top of this ... this "code".
The answer will be ... no ... its getting deleted, any machine its ever been on is getting burned, and any mention of it will be grounds for death.6 -
teacher - gives a lecture about Java Naming Conventions...
Opens Notepad, ( he doesn't use an IDE, when I asked him he told he haven't worked on a IDE before )
and does this
public int user_account_number;
me - *wtf*
thanks God he didn't mess up with the braces and indentation otherwise I would have got eye cancer( already the white theme of notepad was causing nausea)5 -
This is how my prof uses braces:
If () {
test;
} else {
test2;
}
He uses it as an example of how to use line breaks properly.19 -
Inspired by the comment I posted on another rant.
My uni decided to be one of those progressive tech schools that start people with Python. Mind you, I had prepared myself with studying as much as I could with math and programming by automating things and similar stuff in our computer when I was at my previous job, so I had a better idea as to what i could expect.
Introduction to computer science and programming with Python or some shit like that was the name of the class, and the instructor was a fat short ugly woman with a horrible attitude AND a phd in math, not comp sci and barely any industrial knowledge of the field.
She gave us the "a lot of you will fail" speech, which to me is code for "I suck and have no clue what I am doing"
One assignment involved, as per the requirements the use of switch cases. Now, unless someo knew came about, Python does not have swio cases. Me and a couple of less newbie like students tried to point out that switch cases were non existent and that her switch case example was in Javascript, not python, curly braces and everything. She told us to make it work.
We thought that she meant using a function with a dictionary and we pass the key and shit, a simple way of emulating the switch case.
NOPE she took points and insisted that she meant the example. We continuously pointed out that her example was in JS and that at the time Python did not have switch cases. The nasty woman laughed out and said that she didn't expect anyone to finish the assignment with full points.
Out of 100 points everyone got a 70. No problem. Wrote a detailed letter to the dean. Dean replied and talked to her (copied her in the email because fuck you bitch) and my grade was pulled up to full mark.
Every other class I had with her she did not question me. Which was only another class on some other shit I can't remember.
Teachers are what make or break a degree program. What make or break the experience, going to college is putting too much faith on people. If you ask me, trade certification, rigorous training is the future of computer science, or any field really. Rather than spending 4+ years studying a whoooole lotta shit for someone to focus on one field and never leave it.17 -
A lot of phrases we use in software would make awesome alternative-rock band names.
- Integer Overflow
- Curly Braces
- Recursion
- Callback Hell
- Daemon Processes
- Nested Loop
- Regular Expressions
Source: Twitter2 -
It was the first time I worked on a big project with a big team, I looked at the given code and copied their code style.
I finished very fast and everything was working fine, was really proud of myself. I'd like to add some logging though.
Programm failed it was heavily async and parallel so 2 days of debugging had past the whole team was on board nobody knew what went wrong there.
As I stared into the darkness of my code I suddenly saw what went wrong 😂
As I adopted no curly braces style of the Team for
If (condition)
Justine();
And I added logging above without braces everything broke 😂 it was indented properly so as a heavily python user everything looked fine2 -
In C# you can open as many scopes wherever you want at whatever time you please. Nested within themselves, doesn't matter.
Use this to fuck with the other developers on your team. Fence off their evil code behind a thousand curly braces!
Or maybe jazz up your indentation, give the code a nice and bouncy flow!20 -
I just wrote, "We don't use braces for if in this package".
For if in! What the hell am I speaking!1 -
I really dislike when people don't use braces { } on if/else statements.
If(almond.harvestStatus == undefined) almond.harvestMode=false
almond.dropdown = false.2 -
developer makes a "missed-a-semicolon"-kind of mistake that brings your non-production infrastructure down.
manager goes crazy. rallies the whole team into a meeting to find "whom to hold accountable for this stupid mistake" ( read : whom should I blame? ).
spend 1-hour to investigate the problem. send out another developer to fix the problem.
... continue digging ...
( with every step in the software development lifecycle handbook; the only step missing was to pull the handbook itself out )
finds that the developer followed the development process well ( no hoops jumped ).
the error was missed during the code review because the reviewer didn't actually "review" the code, but reported that they had "reviewed and merged" the code
get asked why we're all spending time trying to fix a problem that occurred in a non-production environment. apparently, now it is about figuring out the root cause so that it doesn't happen in production.
we're ALL now staring at the SAME pull request. now the manager is suddenly more mad because the developer used brackets to indicate the pseudo-path where the change occurred.
"WHY WOULD YOU WASTE 30-SECONDS PUTTING ALL THOSE BRACES? YOU'RE ALREADY ON A BRANCH!"
PS : the reason I didn't quote any of the manager's words until the end was because they were screaming all along, so, I'd have to type in ALL CAPS-case. I'm a CAPS-case-hater by-default ( except for the singular use of "I" ( eye; indicating myself ) )
WTF? I mean, walk your temper off first ( I don't mean literally, right now; for now, consider it a figure of speech. I wish I could ask you to do it literally; but no, I'm not that much of a sadist just yet ). Then come back and decide what you actually want to be pissed about. Then think more; about whether you want to kill everyone else's productivity by rallying the entire team ( OK, I'm exaggerating, it's a small team of 4 people; excluding the manager ) to look at an issue that happened in a non-production environment.
At the end of the week, you're still going to come back and say we're behind schedule because we didn't get any work done.
Well, here's 4 hours of our time consumed away by you.
This manager also has a habit of saying, "getting on X's case". Even if it is a discussion ( and not a debate ). What is that supposed to mean? Did X commit such a grave crime that they need to be condemned to hell?
I miss my old organization where there was a strict no-blame policy. Their strategy was, "OK, we have an issue, let's fix it and move on."
I've gotten involved ( not caused it ) in even bigger issues ( like an almost-data-breach ) and nobody ever pointed a finger at another person.
Even though we all knew who caused the issue. Some even went beyond and defended the person. Like, "Them. No, that's not possible. They won't do such dumb mistakes. They're very thorough with their work."
No one even talked about the person behind their back either ( at least I wasn't involved in any such conversation ). Even later, after the whole issue had settled down. I don't think people brought it up later either ( though it was kind of a hush-hush need-to-know event )
Now I realize the other unsaid-advantage of the no-blame policy. You don't lose 4 hours of your so-called "quarantine productivity". We're already short on productivity. Please don't add anymore. 🙏11 -
Why is it that virtually all new languages in the last 25 years or so have a C-like syntax?
- Java wanted to sort-of knock off C++.
- C# wanted to be Java but on Microsoft's proprietary stack instead of SUN's (now Oracle's).
- Several other languages such as Vala, Scala, Swift, etc. do only careful evolution, seemingly so as to not alienate the devs used to previous C-like languages.
- Not to speak of everyone's favourite enemy, JavaScript…
- Then there is ReasonML which is basically an alternate, more C-like, syntax for OCaml, and is then compiled to JavaScript.
Now we're slowly arriving at the meat of this rant: back when I started university, the first semester programming lecture used Scheme, and provided a fine introduction to (functional) programming. Scheme, like other variants of Lisp, is a fine language, very flexible, code is data, data is code, but you get somewhat lost in a sea of parentheses, probably worse than the C-like languages' salad of curly braces. But it was a refreshing change from the likes of C, C++, and Java in terms of approach.
But the real enlightenment came when I read through Okasaki's paper on purely functional data structures. The author uses Standard ML in the paper, and after the initial shock (because it's different than most everything else I had seen), and getting used to the notation, I loved the crisp clarity it brings with almost no ceremony at all!
After looking around a bit, I found that nobody seems to use SML anymore, but there are viable alternatives, depending on your taste:
- Pragmatic programmers can use OCaml, which has immutability by default, and tries to guide the programmer to a functional programming mindset, but can accommodate imperative constructs easily when necessary.
- F# was born as OCaml on .NET but has now evolved into its own great thing with many upsides and very few downsides; I recommend every C# developer should give it a try.
- Somewhat more extreme is Haskell, with its ideology of pure functions and lazy evaluation that makes introducing side effects, I/O, and other imperative constructs rather a pain in the arse, and not quite my piece of cake, but learning it can still help you be a better programmer in whatever language you use on a day-to-day basis.
Anyway, the point is that after working with several of these languages developed out of the original Meta Language, it baffles me how anyone can be happy being a curly-braces-language developer without craving something more succinct and to-the-point. Especially when it comes to JavaScript: all the above mentioned ML-like languages can be compiled to JavaScript, so developing directly in JavaScript should hardly be a necessity.
Obviously these curly-braces languages will still be needed for a long time coming, legacy systems and all—just look at COBOL—, but my point stands.7 -
A famous quote attributed to Jamie Zawinski:
"Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems."
I am living this nightmare. Joined a project where schmucks are parsing SQL using regular expressions. Talked to a friend, a compiler developer expert. He told me that regexes can't be used for checking if braces are matched. Pumping Lemma. Those fuckers should have used ANTLR or something. Anyways planning to leave this project.2 -
Hi everyone, I'm a now second year computer science student. I have read through posts on Dev Rant for a while now and have loved every minute of it. I really wanted to start contributing to this awesome community and thought a question might be a good start. There seems to be a ton of inconsistencies among certain terms. The biggest that really grinds my gears is how people refer to "()", "[]", and "{}". I personally refer to the first set as parenthesis, the second as brackets, and the third as braces. Throughout my time at this college and around the internet I have read some people say curly braces, curly brackets, squigly brackets, round brackets, square braces, and my personal favorite "those curvy round things". Other students do this which is understandable, but it seemed strange that even my professors use them interchangeably. So is there a naming convention anywhere that might help with this issue or somewhere I can get some clarification?4
-
I used to fucking love VSCode it visually was great, it was simple, had an integrated terminal that wasn't shit, supported many languages well (while not forcing every extension down your throat), and was straightforward to configure. I also had problems with it, mainly I felt it was way too bloated for an editor.
That good impression I had is gone now. It seems like every time I'm actually using the editor I have to fight with it. Whether that's an update that fucked up my config, or a reinstall and now I have to **convince** my fucking editor to use tabs instead of spaces automatically and I have to specify because holy shit it will not just listen after I set every possible fucking indentation setting to disable spaces or enable/prefer tabs and they keep adding shit like this that I give no shits about that make me sift through the damn settings finding the settings that turn off whatever new visual effect or quirky little automation they've implemented. I can't tell you how much I actively don't want my braces to be matched up by a color that doesn't even have anything to do with my color scheme.
Ive tried switching but holy shit intellisense is such a great feature that helps me so much so I'm not always bouncing between docs and my editor. Which ATM I'm learning go and intellisense has more fucking information on the functions than the docs do. I've seen Neovim (which is what I'm probably switching to) has language servers that are similar to intellisense so I'm intrigued to try that.
I'm just tired of constantly having to avoid all this shit I don't give a fuck about. I just want to get in, do my thing.
I won't be surprised if I'm the only one on this train 🤣8 -
Came across a book by Clinton L. Jeffery that details in programming language design, a topic that has always fascinated me. So I went ahead and bought the book knowing full well it uses an obscure language called Unicon (cool fucking name) devised in order to mimic the Icon programming language (obscure as well) which are languages that detail goal oriented programming. While I do not mind the language itself, seems pretty good for my taste, does not use curly braces or semicolons and a lot of other scripty things, gets compiled to bytecode and works well, but shit man, trying to find documentation for this outside of its own (I don't like it) book is a pain in the ass. To give some perspetive: you know you are dealing with some obscure shit when there ain't any youtube videos on the language. It has some interesting notions, but I just fucking hate the "documentation standard" book that it has for it, and yes, this is because the language has not taken any actual traction from the masses, there are some things that it does not have such as full utf8 support among other things, it really is a nice tech but I hate the lack of proper documentation/tutorials on it.
rant off2 -
To all Python devs: if you want to use curly braces like in C-like languages use this import statement:
from __future__ import braces
Thank me later :D1