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 - "namespaces"
-
Client: "Hi, there's a problem with this link"
Me: "How odd, I'll take a look right away"
-- 19 minutes later --
Client: "Has this been fixed?"
Me: "I'm working on it currently"
Client: "OK please let us know when it's done"
Me: "I will do"
-- 2 minutes later --
Client: "Hi, is this done?"
Me: "I've just told you I will let you know as soon as it's done"
-- 5 minutes later --
Client: "Hi, sorry to hassle, but is this done yet?"
Me: *starts twitching*
Me: "I am working on it and I will let you know when it's done"
Client: "OK, well don't worry about it, it doesn't really matter"
Me: *explodes*10 -
Client has asked me to sign an NDA. They've emailed me the NDA and asked that I print two copies of it, one which I must sign and return to them, and the other to keep for myself. Because I'm to print it twice, they've attached two copies of the NDA in PDF form. They're identical, I've checked.4
-
Here's my piece of advice for new devs out there:
1 - Pick one language to learn first and stick with it, untill you grasp some solid fundamentals. (Variables, functions, classes, namespaces, scope, at least)
2 - Pick an IDE, and stick with it for now. Don't worry about tools yet. Comment everything you're coding. The important thing is to comment why you wrote it, and not what it does. Research git and start using version control, even when coding by yourself alone.
3 - Practice, pratice and pratice. If you got stuck, try reading the language docs first and see if you can figure it out yourself. If all else fails, then go to google and stackoverflow. Avoid copying the solution, type it all and try to understand it.
4 - After you feel you need to go to the next level, research best practices first, and start to apply them to your code. Try to make it modular as it grows. Then learn about tools, preprocessors and frameworks.
5 - Always keep studying. Never give up. We all feel that we have no idea of what we are doing sometimes. That's normal. You will understand eventually. ALWAYS KEEP STUDYING.9 -
HE:"Hey I improved my code"
ME:
*opens the file*
*Sees random static allocations*
*Code is as verbose as before*
*Down to 2600 lines from 2800ish*
*Still doesn't do shit properly*
"Uuuh what exactly did you do?"
*Starts noticing the lack of namespaces*
HE: "I used this using namespace std to write a bit less"
ME: "Can I pay you yoga lessons so you can taste your own cock and show your parents how good you are at it?"3 -
"By larger do you mean bigger?"
I was honestly just asked this in an email from a client.
The funniest thing is I didn't even say "larger", I said "bigger".8 -
The gift that keeps on giving... the Custom CMS Of Doom™
I've finally seen enough evidence why PHP has such a bad reputation to the point where even recruiters recommended me to remove my years of PHP experience from the CV.
The completely custom CMS written by company <redacted>'s CEO and his slaves features the following:
- Open for SQL injection attacks
- Remote shell command execution through URL query params
- Page-specific strings in most core PHP files
- Constructors containing hundreds of lines of code (mostly used to initialize the hundreds of properties
- Class methods containing more than 1000 lines of code
- Completely free of namespaces or package managers (uber elite programmers use only the root namespace)
- Random includes in any place imaginable
- Methods containing 1 line: the include of the file which contains the method body
- SQL queries in literally every source file
- The entrypoint script is in the webroot folder where all the code resides
- Access to sensitive folders is "restricted" by robots.txt 🤣🤣🤣🤣
- The CMS has its own crawler which runs by CRONjob and requests ALL HTML links (yes, full content, including videos!) to fill a database of keywords (I found out because the server traffic was >500 GB/month for this small website)
- Hundreds of config settings are literally defined by "define(...)"
- LESS is transpiled into CSS by PHP on requests
- .......
I could go on, but yes, I've seen it all now.12 -
i was asked to start a new project, and another dev was brought onto the team shortly after. as soon as he joined, straight away he started an entirely new project and worked on it through the whole weekend, then came back on monday and just sort of pasted his files into/over the code i had already started and was working on, with no regard for folder structure or naming conventions or anything. his work was even split between 2 almost identically named namespaces (both of which were completely different to the existing project namespace) and his shit broke everything i did in the first place. the cherry on top is that none of his work was even functional, it was purely dummy/mockup web pages that weren't linked to any sort of backend.
when i asked him wtf he thought he was doing, he kept saying "i didnt touch your code" and refused to acknowledge that pasting a project over a different project can break stuff, then said it "wasn't his fault that i'm slow and not keeping up". and just kept saying vague bullshit about how i have to do it his way because he "has more experience"
he had no idea what my previous experience was, he had never asked and i had never told him, he just decided that he had more experience than me.
i dug through the shit and found out that he didn't just break my work, he had actually purposely deleted it when he realised it was getting in the way of his spaghetti. i showed him the commit and confronted him with it and all the cunt said was "well the good news is, you know the fix" and kept trying to dismiss me in the most disrespectful ways he could think of. i eventually snapped at him (long overdue at this point) and told him that any experienced developer would not commit code that didn't even fucking compile, especially when they're the one who broke it, and that he needs to grow up. of course he then complained that i was being unprofessional.
our manager decided we should go with fuckfaces """code""" without even looking at the work either of us had done, purely because fuckface is older than me and that's how the world works.
in the end i just told my manager that i refuse to work with the guy and he could either take him or me off the project (guess who he picked) or i quit.
after a few months of the guy failing to deliver any of even the basic functionality that was asked for, the entire project got scrapped, and the dude just quit once everyone realised he was literally just larping as an experienced dev but couldn't accomplish simple tasks.
i never received an apology from anybody involved.5 -
Client asks me to implement pie chart on webpage. Sum of figures supplied amounts to > 100%. Pointing out discrepancy I request the correct figures, only to be told that the figures are correct. Very well. One week passes. Receive email from client: "The figures for this chart are wrong, they total > 100%, here are the correct figures...". *Sigh*.1
-
Why the fuck does Arduino use C++ macros for min, max, abs, etc. ???????
---
For those who don't know what a macro is, basic example:
#define abs(x) (x > 0 ? x : -(x))
Which looks like a function, but instead abs() will be replaced by the expression and all x will be replaced literally with what you pass to abs
So
abs(i++)
would evaluate to
(i++ > 0 ? i++ : -(i++))
which would call i++ twice
---
I guess I will have to double check every built in function and rewrite it if it's a macro -_-. Not taking any chances. Btw all Arduino functions are in one big file, so now I have to pollute my code with namespaces.
Macros can be great but what the fuck.16 -
Not exactly dev stuff, but LaTeX low-key makes me nervous.
In writing my thesis it seems that through some keyboard-fuckery I managed to slip in some weird unicode bullshit character somewhere, so that it doesn't compile. Alright, I just do \DeclareUnicodeCharacter{0301}{ASDF} so that it gets replaced by ASDF. Searching for ASDF in the output pdf file does not yield results, so I can't even find the location of the fuckery in the text. It seems that unicode character is somewhere in my .bib-file and I guess my citation style doesn't even render the part of the data that character is in after all. So the above hack works, but still there is some weird-ass character in my bibliography file that I can't find.
On another note: I get that modularity is cool and all, but who thought that it is a good idea to give people zero transparency over what macro stems from which included package? No namespaces etc. I end up including a whole lot of packages that are needed for exactly one macro. That bloats up the file and you have no way to trace back which macro came from which of the quazillion included packages.
...then again maybe I'm just a lazy piece of shit whose google searches end before success and all of the above has some easy fix.9 -
Client called with a query regarding her email client. Said to me during the conversation, "I've got yozzamite". Took me a few moments to realise that she meant Yosemite.8
-
Client says the styling of a particular component on their website is wrong. It looks fine to me. They can't give me an example of how it should look, or tell me what's wrong with the way it looks currently, but they want me to fix it.3
-
The worst architecture I've seen is WordPress.
How can you be so drunk to design such a filthy mess?
In some way PHP might be to blame. Its API is a fucking mess as well and may have stirred WP developers in this puke around so they couldn't come up with a better CMS architecture.
Don't get me wrong. I do love PHP. But only in it's OO form with namespaces and type hints and composer dependencies.
I've seen enough of PHP functional programming and it still haunts me.8 -
So I saw this argument between two intellectual titans on Quora about C vs C++. It was pretty amusing lol.
First Guy: “C programmers are the Amish! They’re afraid of change. C++ is a better C because it repairs it insufficiencies like classes and namespaces.”
Second guy: “C is fairly consistent, while C++ is inconsistent in many places. It performs so many allocations without you even knowing it. It’s complexity is very distracting !”10 -
Reinvent the wheel workaround: Rename the wheel.
Since you cannot reinvent it, because it already exists and it's working, just call it "rolling circular object" and get away with it.
Why in hell I should call packages "namespaces"?
A package can contain a lot of things actually. It's visual, you can create an icon for it.
Namespace? is that even a word?
Next time I rent an apartment, I'll ask if they have a FuckSpace instead of a bedroom.
"Well, it's a small studio, there is only a ShitSpace and an Open EatAndFuckSpace"
Will do.7 -
Just wondering, fellow devRanters...
Q: What is your favorite programming language, and why?
I'm currently studying Unity, so I'm in love with C#, it helped me understand a lot of concepts like namespaces, encapsulation, constructors, something that I was struggling to grasp with PHP, which I use every single day at work.13 -
Testers in my team have been told like 1000 times to follow the style guides that we all follow. That's not that big a deal. The big deal is that they were put on this project without having any mathematics background when the project is all about geometric stuff. So after me as a developer having to put so many hours to explain to them why the tests are not covering the requirements or why the tests are red because they are initializing the data completely wrong, I ask them pretty please to do the checks for the coding style and I have already been 4 hours reviewing code because not only I have to go through the maths and really obscure testing code to ensure that the tests are correct, but every line I have to write at least 4 or 5 style corrections. And some are not even about the code being clean, but about using wrong namespaces or not sticking to the internal data types. For fuck shake, this is embedded software and has to obey to certain security standards...3
-
Laravels error reporting is sometimes fucking useless. Yesterday it wrote into the logs "class foo doesn't exist". I triple checked the including of this class. Checked the namespaces. Checked the classnames. Everything was ok.
Today I removed the content of this particular class, which returned an array. And the error was gone...
After further search I realized I was missing commas within the array deceleration...
Why the fuck you don't just tell me this????!?4 -
Client just asked if I could make a dropdown menu appear when a navigation item is hovered over. ON MOBILE.2
-
I've spent a lot of time messing around with C, having struggled with object-oriented programming (due to not really knowing how best to structure things, not knowing when to apply certain design patterns).
When writing C code, I'd write OOP-esque code (pass around a struct to routines to do things with it) and enjoyed just making things happen without having to think too much about the overall design. But then I'd crave being able to use namespaces, and think about how the code would be tidier if I used exceptions instead of having every routine return an error code...
Working with Python and Node over the past couple of years has allowed me to easily get into OOP (no separate declaration/definition, loose typing etc.) and from that I've made some fairly good design decisions. I'd implemented a few design patterns without even realising which patterns they were - later reading up on them and thinking "hey, that's what I used earlier!"
I've also had a bit of an obsession with small executable files - using templates and other features of C++ add some bloat (on Windows at least) compared to C. There were other gripes I had with C++, mostly to do with making things modular (dynamic linking etc.) but really it's irrelevant/unreasonable.
And yes, for someone who doesn't like code bloat, working with Node is somewhat ironic... (hello, node_modules...)
So today I decided to revisit C++ and dust off my old copy of C++ in a Nutshell, and try to see if I could write some code to do things that I struggled with before. One nice thing is that this book was printed in 2003, yet all of its content is still relevant. Of course, there are newer C++ standards, but I can happily just hack away and avoid using anything that has been deprecated.
One thing I've always avoided is dynamic_cast because every time I read about it, I read that "it's slow". So I just tried to work around it when really if it's the right tool for the job, I might as well use it... It's really useful!
Anyway, now I've typed all this positivity about C++ I will probably find a little later on that I hit a wall with what I'm doing and give up again... :p7 -
Not sure if it's the worst code review but it's a recent one.
We don't really do code reviews where I work unfortunately but my coworker used my framework for the first time (build some nice composer libraries for cmdline projects) and asked if I could make them do autoloading.
He never used namespaces before so I was glad to help him out.
What I saw was a dreadful mess. His project was called "scripts" so good luck picking a namespace...
Than it was all lose functions in the executable file. All those functions are however called by a class in another file (if they where not calling eachother as a cascading mess). That class was extending an abstract class from my library as instructed. However I never imagined my lib being raped like that.
The functions themselves are a horrible mess. Nothing uniform completely different style (our documentation states PSR's should be used).
Parameters counts higher than 5.
Variable names like Object and Dobject (in calling function Dobject is Object but it needs a fresh one.
If statements on parameters that need basically split it in two (should simply be to functions)
If else statement with return of same variable as a single line (sane people use ternary for that)
Note that I said functions. All of it should have been OO and methods. Would have saved at least some of the parameter hell.
I could go on and on. Do I think the programmer is bad yes (does not even grasp interfaces, dep injection, foreach loops). Is this his best work no. He said that for a one of script like this it just has to work. Not going to be used elsewhere. I disagree as it is a few thousand lines of code that others have to read too.2 -
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!1 -
You know your doing a quick and dirty job for a diagnostic tool when every method you create in alternate namespaces is static...
Suppose I should probably stop doing that aye...3 -
man just please include the using statements in your examples, because i don't know what namespaces i need to use in your dumbass examples4
-
Found this gem a while ago that made my day
if ( $this->isExternal() ) {
// This probably shouldn't even happen. ohh man, oh yuck.
// But for interwiki transclusion it sometimes does.
// Shit. Shit shit shit.
//
// Use the canonical namespaces if possible to try to
// resolve a foreign namespace.
if ( MWNamespace::exists( $this->mNamespace ) ) {
return MWNamespace::getCanonicalName( $this->mNamespace );
}
In a not too old version for mediawiki, the codebase for Wikipedia.
https://phabricator.wikimedia.org/s... -
How, how can I be sooooo bad sometimes.
I just discovered “Alias” feature of C#.
Let’s say you have 2 enums with the same name (Let’s say MyAwsomeEnum) in 2 different namespaces.
In this case I was always full qualifying the name.
I was today years old when I discovered “using MyAwsomeEnum = <Fully qualified name>” in the using section.
Edit : Even worse. It's like 3d example in official doc
https://docs.microsoft.com/en-us/...
/facepalm on my self6 -
I'm going to confess: I am the type of developer that creates the ExcruciatinglyLongAndSpecificClassNameObject with the UtterlyDetailedExplanationMethod. It's just a thing I keep doing, despite voiced frustrations from people I've worked with. It just feels right in the mindset of self-documenting code
And while I acknowledge this isn't a flawless process, I see no other way around without losing information. I've tried alternatives, but everything feels like trading one issue for another:
- Abbreviations work as long as they are well known (XML, HTML, ...). As soon as you add your own (even if they make sense in the business context) you can bet your ass someone is going to have no idea what you're talking about. Even remembering your own shit is difficult after X months.
- Removing redundant naming seems fine until it isn't redundant anymore (like when a feature with similar traits gets added). and you can bet your ass no-one is going to refactor the existing part to specify how it differs from the newly added stuff.
- Moving details to namespaces is IMO just moving the problem and pretending it doesn't exist. Also have had folks that just auto-include namespaces in VS without looking if they need the class from namespaceA or namespaceB and then proceed to complain why it doesn't compile.
So, since I am out of ideas, I'd like to ask you folks: Is it possible to reduce class/method name lengths without losing information? Or is self-documenting code just an ideal I'm trying too hard to achieve? Or are long names not a problem at all? I'm looking forward to your answers.19 -
TIL:
How to become root w/o having to provide a password:
unshare -rm
no go ahead and bind-mount your own /etc/hosts (or any other file/directory) w/o affecting the rest of the system!1 -
Client emails and asks why a certain element appears on particular page of their website. I respond by saying that they'd asked me to place it there. I then find and forward them the email in which they requested that I place the element on the page. Client replies to forwarded email, "What is this in relation to?".
I must stress that this was all in the space of about two minutes and no other emails were exchanged in-between; there was zero possibility of crossed wires. -
Client had me implement an exit intent modal on their website, inviting visitors to sign up to their mailing list when they moved to close the browser tab.
Client then had me implement an on page load modal which displays the poster for their upcoming event.
Client just emailed "Double popup happening!" with a screenshot of their website with both modals displayed at once.
Kicking myself for replying and explaining that this was expected behaviour in light of what they'd asked for instead of responding, simply, "Yes".1 -
Have to translate an API library from Ruby into PHP for work, and I swear it's all of the worst pieces of BASIC and Swift thrown together. To top it off, looking up a symbol chart for it to try and get a handle on the symbols they love to throw in front of variable and method names is useless because "symbol" is a freaking type in this language! Arrays are apparently called "hashes" now, and I can't quite tell if modules are supposed to be namespaces or classes yet...
If Ruby has redeeming qualities, I'm definitely open to hearing them. Right now I'm kind of feeling homesick for vanilla C, however...1 -
Client's WordPress powered site has gone down due to influx of traffic. Site is cached and whatnot, the server it's on is simply underpowered and not coping. Whilst I'm frantically trying to spin up new servers and load balance and get things back online, client keeps interrupting with emails like "URGENT - Website is down", "How long is this going to take please?", and "Hello! Do you know whats going on?!". I reply cordially to each, secretly growing increasingly enraged. "Yes I am already aware and working on it.", "Difficult to estimate, but I'm hoping no more than 20 minutes.", "Yes. I'm working on it.", "Yes, I know. I'm working on it."
And then I receive this gem: "Perhaps call Word press?"
AARRGGHHH
This scene from Clerks springs to mind: https://youtube.com/watch/...2 -
Ok so I got namespace N.
And namespaces N\a and N\b.
I would like N\a\foo() to call N\b\bar().
But no matter what I do it says \N\b\bar() does not exist. What am I doing wrong??
I've tried including, using, requiring but nothing.8 -
Rubber ducking your ass in a way, I figure things out as I rant and have to explain my reasoning or lack thereof every other sentence.
So lettuce harvest some more: I did not finish the linker as I initially planned, because I found a dumber way to solve the problem. I'm storing programs as bytecode chunks broken up into segment trees, and this is how we get namespaces, as each segment and value is labeled -- you can very well think of it as a file structure.
Each file proper, that is, every path you pass to the compiler, has it's own segment tree that results from breaking down the code within. We call this a clan, because it's a family of data, structures and procedures. It's a bit stupid not to call it "class", but that would imply each file can have only one class, which is generally good style but still technically not the case, hence the deliberate use of another word.
Anyway, because every clan is already represented as a tree, we can easily have two or more coexist by just parenting them as-is to a common root, enabling the fetching of symbols from one clan to another. We then perform a cannonical walk of the unified tree, push instructions to an assembly queue, and flatten the segmented memory into a single pool onto which we write the assembler's output.
I didn't think this would work, but it does. So how?
The assembly queue uses a highly sophisticated crackhead abstraction of the CVYC clan, or said plainly, clairvoyant code of the "fucked if I thought this would be simple" family. Fundamentally, every element in the queue is -- recursively -- either a fixed value or a function pointer plus arguments. So every instruction takes the form (ins (arg[0],arg[N])) where the instruction and the arguments may themselves be either fixed or indirect fetches that must be solved but in the ~ F U T U R E ~
Thusly, the assembler must be made aware of the fact that it's wearing sunglasses indoors and high on cocaine, so that these pointers -- and the accompanying arguments -- can be solved. However, your hemorroids are great, and sitting may be painful for long, hard times to come, because to even try and do this kind of John Connor solving pinky promises that loop on themselves is slowly reducing my sanity.
But minor time travel paradoxes aside, this allows for all existing symbols to be fetched at the time of assembly no matter where exactly in memory they reside; even if the namespace is mutated, and so the symbol duplicated, we can still modify the original symbol at the time of duplication to re-route fetchers to it's new location. And so the madness begins.
Effectively, our code can see the future, and it is not pleased with your test results. But enough about you being a disappointment to an equally misconstructed institution -- we are vermin of science, now stand still while I smack you with this Bible.
But seriously now, what I'm trying to say is that linking is not required as a separate step as a result of all this unintelligible fuckery; all the information required to access a file is the segment tree itself, so linking is appending trees to a new root, and a tree written to disk is essentially a linkable object file.
Mission accomplished... ? Perhaps.
This very much closes the chapter on *virtual* programs, that is, anything running on the VM. We're still lacking translation to native code, and that's an entirely different topic. Luckily, the language is pretty fucking close to assembler, so the translation may actually not be all that complicated.
But that is a story for another day, kids.
And now, a word from our sponsor:
<ad> Whoa, hold on there, crystal ball. It's clear to any tzaddiq that only prophets can prophecise, but if you are but a lowly goblinoid emperor of rectal pleasure, the simple truths can become very hard to grasp. How can one manage non-intertwining affairs in their professional and private lives while ALSO compulsively juggling nuts?
Enter: Testament, the gapp that will take your gonad-swallowing virtue to the next level. Ever felt like sucking on a hairy ballsack during office hours? We got you covered. With our state of the art cognitive implants, tracking devices and macumbeiras, you will be able to RIP your way into ultimate scrotolingual pleasure in no time!
Utilizing a highly elaborated process that combines illegal substances with the most forbidden schools of blood magic, we are able to [EXTREMELY CENSORED HERETICAL CONTENT] inside of your MATER with pinpoint accuracy! You shall be reformed in a parallel plane of existence, void of all that was your very being, just to suck on nads!
Just insert the ritual blade into your own testicles and let the spectral dance begin. Try Testament TODAY and use my promo code FIRSTBORNSFIRSTNUT for 20% OFF in your purchase of eternal damnation. Big ups to Testament for sponsoring DEEZ rant.3 -
I'm starting on C# and some of the lesson plans out there dont make sense. So far Bob Tabor and Plural Sight has helped me half way and the bulgarian shark book too. What has helped you cross that threshold past the basics. I'm stuck on structs, namespaces, sort algorithms, sql and json.6
-
Not a horror. I'm rewriting services.
It started as a help request. I was asked to help with completing a service dealing with push notifications which was a research prototype. It was suggested to keep core part of it, but it was so awful that I just removed all files and wrote the service from scratch.
The second service had been developed for more than a year by a junior and then by our manager who wanted to complete it as fast as possible, without taking care of code quality. Then I was asked to take over the project and after some time I agreed with one condition: I'll have 1 month on takeover. But when I looked at the code, it became clear that it's much faster and better to rewrite everything except API and database than to takeover existing code.
The third service dealing with file exchange was working, but the junior who wrote it advised to rewrite it because it was a very simple service. So, I initiated rewriting, designed a new API and reviewed the final result.
And now I'm dealing with the fourth one. It was developed in my team but not under control. Now, when I "inherited" this complicated project, I decided to rewrite it because it should be simple, but it doesn't. It features reflection, layers inside layers, strange namespaces, strange solution structure. And that's after months of refactorings and improvements. So, wish me luck because I want to keep part of the infrastructure, but I don't know if it's possible. -
Does anyone know if there's a list or something with examples of bad variable names? As in ones that shouldn't be used because they're already used namespaces and such?
It would be awfully convenient in situations where you're not sure if it's an okay name or not. :/ -
Around the web and within the CSS Working Group, there has been some discussion about whether we should specify a version of CSS — perhaps naming it CSS4.
I think there is some value in grouping a bunch of specs into tidy version labels like "CSS4". It's much easier for me to ask "does this browser support CSS4?" than it is to ask "does this browser support CSS Color Level 3, CSS Namespaces, Selectors Level 3, etc."
Also, as a developer, if there were a group of specs known as CSS4 gaining traction on the web, I'd know that I need to be well-versed in each included spec, as opposed to just trying to become more fluent in different specs as I come across them in my daily work or research.
Your opinion?8 -
How to organize your projects in Visual Studio with separate Namespaces without naming every project like: <projectname>.<this>.<that>
Instead I want to name the solution <projectname>. And then name my project <this>.<that>?