Ranter
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
Comments
-
@BigBoo
It bothers me that some people use them as if they were namespaces. And then implement singleton patterns or write one class for an entire set of responibilities. -
BigBoo23206y@simulate Reject their pull requests? Or, what am I missing. Who is doing this and how does it impact you?
Or are you just bothered that some people do things differently than you?
See, I still don't have any context to if there is a story here or you are just irritated by some code that someone wrote somewhere. -
@2lazy2debug
well i cant post the entire class, but we have a class in our project which does just EVERYTHING regarding the functionality an entire namespace is supposed to represent.
The class provides interfaces to talk with 10 other modules, connects to a server using tcp, has helpers to quickly do some stuff directly which is actually part of what other classes should do, ... heck i dont even know what else it does! The header file is 700 lines long, eg ~500 functions and variables, in ONE CLASS... I am saying that because I feel like people sometimes treat classes as if they were namespaces (why else would the singleton pattern exist?) while a class should really only be a template for one worker with one job. managers should usually just be a namespace. -
@2lazy2debug
I had too and said so in teamchat and all the devs basically started laughing tears as if to say "good luck pal". I have now dedicated myself to at least break off the part of it that is involved in my ticket, and I hope i dont run into spaghetti... -
@simulate Good luck! The world always needs the brave few who are willing to charge into apparent lost causes. Hopefully you survive the experience.
-
psukys2326yThat's a nice class you got going 😂😂😂
I know that Python's pylint linter warns on such abundances (whrn method can be a function i.e.), so maybe there's a similar type of tool for your lang that you could enforce in your CI? -
In ES5 they actually are..there is no other way to namespace your code other than:
Namespace = {};
Namespace.SomeObject = {};
or
NamespaceSomeObject = {};
Still better than having naming collisions I guess.. -
@psukys
I am already sure that it would mark a lot of possible improvements... 😂😂
Nah, all that would help there is to rewrite the class. But of course my boss doesnt want to "waste time on things that dont directly help the customer", although I would bet that many of our bug reports are related with that class, because it is so central (actually, it is one entire tool in the toolchain of our main product), but who cares.
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Cyborg15A guy and a girl are in a Java seminar. Afterward, the guy approaches the girl and asks, "Hey gurrl, can I ge...
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
Classes are not namespaces!!
rant
oop
classes
c++
namespaces