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 - "decorators"
-
I finally got Redux-Form’s `initialValues` to work! Wooooo~!
/giphy confetti cheering
It turns out I haven’t actually been doing anything wrong for the past week. I mean, I've been working on other things during that week, too, but I've been trying to solve this the entire time.
The cause? ReduxForm made a breaking change awhile ago (v5; we’re using v7) that prevents the `initialValues` prop from working if you decorate your form component in the wrong order. Many examples online are incorrect because of this.
Basically, the decorators `reduxForm` and `connect` do not commute:
Incorrect:
`reduxForm(...)( connect(..., {...})(form) )`
vs Correct:
`connect(..., {...})( reduxForm(...)(form) )`
But what really pisses me off is that the fucking documentation specifically fucking states that you may decorate your component IN ANY [FUCKING] ORDER.
/giphy that is [fucking] false
So, I've been following example after [fucking] example that either list these in the wrong order, or I just don't notice the different order because it doesn't matter. AND because of that NONE OF THE [...] EXAMPLES WORK.
ARGH.
I've been pacing around the office trying to figure this out for days. I've rewritten my code three times to try to solve this. I've written two workarounds for it only to rip them out and try again because they both broke some other part of the UX. (e.g. causing false validation errors after rerender)
just. hafhsldkjhgjkhagklwhsdjfkahslf. 😡
/giphy angry hades
You know how I discovered this?
I found it in a github ticket. One solitary, untagged ticket from October of last year. Not a single goddamn post anywhere else mentioned this. And the [...] documentation specifically [...] states the [...] opposite!
Bloody [...] hell.
but it finally works.
as;kgjhaekl;gahgjkdflssdafh.
I could scream.6 -
I hate when idiots make assumptions without basis. My company so higher up idiots decided not to use Python. I said why they said it’s not scalable. I asked have anyone of you ever wrote micro service which can handle millions request every hours? Have you ever wrote service in Python? Have you ever worked on Python? Architect said but Python doesn’t have type support? I said there is use Python3. He said I want to validate my request payload. I told have you tried form and decorators. I told, I have 8 years experience. I worked in every language and I one has advantage over others depending on situation. Then they said, but we want only Java as finding resources is easy. I said have you checked git Python overtook Java in case resources, you are outdated. I don’t want to leave company but even after so many argument these idiots just dropping Python and because of that I am loosing so many good resources.8
-
I always find reading small configuration files way more difficult than reading a big codebase.
I accept config files do really help in writing a better flexible code and separating the logic and settings but always offer a stiff learning curve.
And often, people make changes in config either unintentionally or with half knowledge which works in local but later blows up the entire system.
Wondering how config files can be presented in a way that the learning curve is minimal and the understandability of its impact is more visible.
I do really like annotations or decorators which provides a closer visibility between config and code. -
Wow Angular2 you are beautiful.
I loved you early on angular 1.x but by the end we drifted apart driven by our diffrent needs. I needed a manageable code base and more excitement you needed to stay the way you are. I respect you for that, but we are not right for each other anymore.
I have been hurt Angular2 i may not fully heal but you provide me with what I need. Developing on you is a pleasure that feels like a full object orientated experience. Most of all developing on you is *fast* your seperation of concerns tickles me in all the right ways. The suger you provide with your decorators, classes, abstract classes and interfaces makes me weak at the knees.
Keep growing and improving Angular 2. I think we shall have many projects together.3 -
So I'm getting brought into a team for our backend services of our administration application, and they're explicitly using Flask (Python library) for their exposed API in their application and data tiers.
As I'm familiarizing myself with their code, utilities, and dependencies, I notice they're stacking 7-8 decorators on their routes from their in-house utility module.. After further investigation, I realized half of them were entirely unnecessary, and they were proofing payload responses three times for the same JSON format.
The fact that we're using Python instead of Node or GoLang for our REST services is pain enough, but these god damn in house utilities are killing me.1 -
I though of a great way to explain to an absolute beginner why you need 3 file types to build a website:
It's like building a house
HTML handles the structure of the house
Javascript handles the electrical and water (things that make the house run)
And CSS, like the decorators that make the house look pretty6 -
Any other people here that find Python to be actually a harder language than Java? With Java it's much easier to keep track of your code and to track what variables refer to certain object types.
It feels like Python has much more quirks and feels therefore much more inconsistent as a language. Object oriented programming is more verbose with static methods and decorators being vague for example. This makes it harder to grasp concepts like design patterns and SOLID principles in Python imo.7 -
At first i was told to go to college BY PEOPLE WITH NO COLLEGE because i wouldnt be able to find a job without degree
Like a sucker i fell for it and believed in those LIES so i sacrificed my life for school
Then later i found out PEOPLE WHO FINISHED COLLEGE told me i just need knowledge in order to be hired, and turns out degree is unimportant
Like a sucker i fell for it and believed in those LIES so i studied and worked on practical projects and gained knowledge
Now when I try to get hired, they admitted that i am able to complete complex projects and i know how to solve the problems even if i see them for the first time. But they rejected me because "im not sure why the car leaks oil".
I have to understand and know what the whole framework is doing under the hood, how everything works, how dependency injection works under the hood, SOLID principles under the hood, decorators how they work under the hood etc.
So now it turns out
- sacrificing life for school is not enough
- sacrificing life for degree is not enough
- sacrificing life for learning and gaining knowledge is not enough
- now the new trend is i have to know not only how to drive a car like a professional formula F1 driver, i also have to be a mechanic and know how to fix the car if it breaks.
MATRIX IS A BIG FAT BULLSHIT AND A LIE.
I feel like they're looking for a senior developer knowledge to pay him junior developer salary
WTF IS THIS BULLSHIT?
I sacrificed 10 days of my life for their bullshit to build this project from scratch as a technical interview. They never said congrats on all the parts that were built right, but only complained about the small portion of bugs i didnt have time to fix.
ALL OF THIS FOR A SALARY OF $1500/MONTH THAT I ASKED. THATS LESS THAN 20,000$ A YEAR. THEY EITHER GAVE ME AN OPTION TO WORK FOR WAY LESS (500-600$/month) OR CALL THEM BACK IN A FEW MONTHS.
I JUST FINISHED COLLEGE AND THEY EXPECT ME TO HAVE 20 YEARS OF SENIOR DEVELOPER EXPERIENCE.
WTF IS THIS SLAVERY BULLSHIT?
HAVING A 500$/MONTH AS ENGINEERING SALARY WITH A DEGREE IS BELITTLING OF THIS JOB.
NO I DONT LIVE IN INDIA I LIVE IN SERBIA. MY DOG IS SICK AND IT COSTS 100$ A DAY JUST FOR HIS TREATMENT. HOW AM I SUPPOSED TO SURVIVE WITH A SLAVE SALARY IN THIS ECONOMIC CRISIS.
I DON'T UNDERSTAND2 -
Why Dart was designed with idiocy:
1) naming conventions are idiotic
Most other languages are smart enough to not throw errors when the variable name matches its type. And lots of others, for any lexemme - only 1 naming kind is allowed.
Fine. Oh wait, there's that thing called existing databases and GraphQL & other APIs, should they all adapt to this? No, because 2) is the bonus
2) String keys in objects. Unless it's a class with boilerplate, you write them as strings and access them as strings.
So here's the solution when you want to integrate Dart with existing services: write a lot of JSONSerializable decorators to fit with dart's pissy naming requirements.3 -
I'm working with a nice piece of code written 6 years ago by somebody who isn't in the company anymore and only the fact that they live on the other side of the continent prevents me from physically strangling them.
They must have thought that they were very smart trying to use JavaScript as a functional language. A shitload of library-specific decorators that ultimately don't do shit except for raising the cognitive load of anybody who hasn't worked with it before. Why the fuck did you use 'curry' in a function that then is never called in a functional manner? Because fuck me, go check the documentation of ramda because you obviously have too much time at work if you ask questions, just to learn fuck all.
It fascinates me how people take this steaming pile of shit that is JavaScript and then try to work against all its design assumptions to create something that is even more slimy, disgusting and smelly. It shows a radical misunderstanding of what you're even working with.
Take shit, add straw and you might have a docent construction material. Take shit, sprinkle it with chilli and try to eat it and it's just hot shit. But at least you will make everyone else try to find out why the fuck is that chilli in there because why would you expect it there. I'm a coprologist, not a cook.3 -
Recommended PHP ORM?
Had a couple bad experiences with Sequelize (I know it's JS, save it). Also, I'd like to try the decorators pattern. I'm also looking for good (and I mean GOOD) relationships management (you are allowed ONE pun about it).
Anyone? :((3 -
The lack of a meta-language in c# can be a pain in the ass, I have to jump through hoops to generate something like python's decorators, not to mention having to generate il to overcome some limitations of reflection when dealing with value types.
-
Anyone know how to effectively write a DI in TypeScript with decorators? I’m working on a TS node framework and need some help4
-
I don't get it, why having more than one decorator looks "weird"? that's idiomatic Python AFAIK, that's sounds more like nitpicking on aesthetics :/1
-
People are like programming environments, in basics all people are the same like all programming environments are the same, every programming language have a loop and conditions, numbers, strings and dates. The problem starts with syntax to write code or can you call it communicate with person. There are syntax errors, someone use functions and classes and that’s ok but someone is writing everything in one file and then it’s hard to communicate or change something. But the real problem are libraries or you can call it believes. Everyone is believing something but when you start using it and want some advanced functions there’s always something missing. When you want to contribute to fix that stuff you often can’t cause it’s closed source or maintainers are pricks. You end up writing wrappers and decorators, ignore malfunctions to somehow live with that problem. That’s called social skills.
We’re just programming environments. That’s all.1 -
#Suphle Rant 8: Strange star discovered
I was searching for a project I'd starred earlier, on my github feed, when I realised a user had starred suphle at some point but for some reason, it wasn't reflecting on the stargazers. I was half overjoyed and half confused. Overjoyed over unlocking the milestone.
User seemed legit –an Italian with projects in C that were not forked. Followers and commit graph are organic. Did he star in error, feel the project is a stinker, or encounter installation challenges? Luckily, I found his email address but all his repositories are in Italian so I wasn't too sure he'd understand English, or if the mail was being attended to. Yet, I took my chances
He surprisingly got back to me, affirming that the star-unstar was actually deliberate. He withdrew the star cuz project's documentation is not hosted online and still requires npm start.
I try to persuade him by reminding him it's just a one liner but that markdown files are equally rendered directly on github. Never heard from him again, sadly
I'm kind of bothered cos I find it funny I thought suphle's APIs are all cast in stone, but the more I work on the docs, the closer I am to spotting something that doesn't sit right with me, and diving in to modify it. This not only prolongs ETA, there's the risk of someone who may have stumbled upon it and is studying it, having the rug pulled from under their feet. Things like validator rules and route-collection service-coordinators have been converted from methods and classes to native decorators. I guess I'm safe since nobody has indicated any signal to the contrary. It'll be pedantic to start tagging versions for each change.
Another consideration is that these breaking changes would go to the first segment of the semver scheme, which is hilarious because the rate at which I push such changes is so alarming, we'd probably progress through 15 versions under a year12 -
#Suphle Rant 6: Deptrac, phparkitect
This entry isn't necessarily a rant but a tale of victory. I'm no more as sad as I used to be. I don't work as hard as I used to, so lesser challenges to frustrate my life. On top of that, I'm not bitter about the pace of progress. I'm at a state of contentment regarding Suphle's release
An opportunity to gain publicity presented itself last month when cfp for a php event was announced last month. I submitted and reviewed a post introducing suphle to the community. In the post, I assured readers that I won't be changing anything soon ie the apis are cast in stone. Then php 7.4 officially "went out of circulation". It hit me that even though the code supports php 8 on paper, it's kind of a red herring that decorators don't use php 8 attributes. So I doubled down, suspending documentation.
The container won't support union and intersection types cuz I dislike the ambiguity. Enums can't be hydrated. So I refactored implementation and usages of decorators from interfaces to native attributes. Tried automating typing for all class properties but psalm is using docblocks instead of native typing. So I disabled it and am doing it by hand whenever something takes me to an unfixed class (difficulty: 1). But the good news is, we are php 8 compliant as anybody can ask for!
I decided to ride that wave and implement other things that have been bothering me:
1) 2 commands for automating project setup for collaborators and user facing developers (CHECK)
2) transferring some operations from runtime to compile/build TIME (CHECK)
3) re-attempt implementing container scopes
I tried automating Deptrac usage ie adding the newly created module to the list of regulated architectural layers but their config is in yaml, so I moved to phparkitect which uses php to set the rules. I still can't find a library for programmatically updating php filed/classes but this is more dynamic for me than yaml. I set out to implement their library, turns out the entire logic is dumped into the command class, so I can neither control it without the cli or automate tests to it. I take the command apart, connect it to suphle and run. Guess what, it detects class parents as violations to the rule. Wtflyingfuck?!
As if that's not bad enough, roadrunner (that old biatch!) server setup doesn't fail if an initialization script fails. If initialization script is moved to the application code itself, server setup crumbles and takes the your initialization stuff down with it. I ping the maintainer, rustacian (god bless his soul), who informs me point blank that what I'm trying to do is not possible. Fuck it. I have to write a wrapper command for sequentially starting the server (or not starting if initialization operations don't all succeed).
Legitimate case to reinvent the wheel. I restored my deleted decorators that did dependency sanitation for me at runtime. The remaining piece of the puzzle was a recursive film iterator to feed the decorators. I checked my file system reader for clues on how to implement one and boom! The one I'd written for two other features was compatible. All I had to do was refactor decorators into dependency rules, give them fancy interfaces for customising and filtering what classes each rule should actually evaluate. In a night's work (if you're discrediting how long writing the original sanitization decorators and directory iterator), I coupled the Deptrac/phparkitect library of my dreams. This is one of the those few times I feel like a supreme deity
Hope I can eat better and get some sleep. This meme is me after getting bounced by those three library rejections