#dependency injection
Explore tagged Tumblr posts
Text
Understanding Services and Dependency Injection in Drupal
Every Drupal developer should understand Services and Dependency Injection. Learn how these concepts simplify coding, improve efficiency, and help create cleaner, more scalable Drupal websites.

0 notes
Text
Инверсия контроля и Внедрение зависимостей (IoC и DI)?
Инверсия контроля (она же инверсия управления или inversion of control) подразумевает ослабление связей между объектами в программе и передачу управления потоком выполнения фреймворку.
Ослабления связей между объектами
Существует два класса: Person (человек) и Dress (платье). Человеку нужно носить одежду и мы можем дать ему платье следующим образом:
class Person { private Dress clothes = new Dress(); }
Вроде всё получилось, но теперь этот человек может носить только платья. А если ему придётся надеть что-то другое?
Это сильная зависимость. И её можно ослабить, написав интерфейс:
interface Clothes { //какие-то методы одежды }
Далее, классом Dress реализовать данный интерфейс:
class Dress implements Clothes { //какие-то поля платья }
И заменить класс Dress у поля Person на интерфейс Clothes:
class Person { private Clothes clothes = new Dress(); }
Теперь, если мы захотим одеть человека во что-нибудь другое, мы можем написать новый класс, скажем, для костюма, реализовать им интерфейс одежды и просто передать человеку:
class Suit implements Clothes { //какие-то поля костюма }
class Person { private Clothes clothes = new Suit(); }
Отлично, теперь наш код стал гибче, но осталось исправить ещё одну вещь.
Категорически не рекомендуется создавать необходимые объекты через new внутри других классов. Вместо этого надо принимать объекты извне. Для этого используются конструкторы или сеттеры.
class Person { private Clothes clothes; //конструктор public Person(Clothes clothes) { this.clothes = clothes; } //сеттер public void setClothes(Clothes clothes) { this.clothes = clothes; } }
И после этого объект Person можно будет создать в главном классе, который является точкой начала выполнения программы:
public class Main { public static void main(String[] args) { //создали человека в платье Person person = new Person(new Dress()); //переодели человека в костюм person.setClothes(new Suit()); } }
Передача объектов внутрь других объектов и называется Dependency Injection (внедрение зависимостей)
Передача управления фреймворкам
Без фреймворков программист сам решает что, где, и в какой последовательности работает. В ином случае, уже фреймворк решает, что и когда заработает в коде (чаще всего это реакции на действия пользователей web-приложений), а программист пишет код только там, где дозволено (в контроллерах, сервисах и пр.).
Ну вроде понятно.
#студент бормочет#инверсия контроля#внедрение зависимостей#инверсия управления#inversion of control#dependency injection#di#ioc#у тамблера странно работает выделение текста цветом - цвет иногда съезжает#и это БЕСИТ#Я ПЯТЫЙ РАЗ РЕДАКТИРУЮ ПОЧЕМУ ТЕКСТ НЕ ХОЧЕТ БЫТЬ ФИОЛЕТОВЫМ
1 note
·
View note
Text
you know the au where a flower shop and tattoo shop are right next to each other and the characters kiss kiss fall in love? walk with me: kingdon au where mel works at the tattoo shop okay it’s steady income while she goes to med school & she finds the whole thing to be so fascinating runs into the newest worker at the flower shop right next door. mel goes there all the time w/ becca because becca got REALLY into ikebana after workshop at her center. she’s very friendly with the owner, a very sweet elderly woman named mary beth who always helps becca pick out the best flowers to go with whatever flower arrangement she’s working on. she’s coming off a long day of lectures and a shift at the tattoo shop when she stops by the flower shop to pick up some lilies for becca.
except the person behind the counter is not mary beth. no, it’s a tall man with striking blue eyes, a little divot in his chin, and dark hair that swoops perfectly against his forehead and a charming smile that makes her stomach do something weird and fluttery. he introduces himself as frank langdon—mary beth’s grandson who is helping out at the shop occasionally when he’s not working. because oh yeah did he mention? he’s a first year resident and of course she knew that because mary beth love to gush about her grandson and coincidentally guess what!!! mary beth also gushed about mel to frank just as much
keep on walking with me! the two of them become friends and one day frank waltzes into the shop and asks if mel will give him a tattoo. he wants a daisy right on his chest near his collarbone near his heart. mel does it and tries very hard to keep it professional and clinical because frank is laying back on the table with no shirt on and his gaze is so focused on her hands and the flush that is no doubt high on her cheekbones. she tries so hard to not think about the fact that daisies are her favorite flowers and that she offhandedly told him that a few months ago when they were first starting to get to know each other. she ignores the vase next to her workstation full of daisies and sunflowers that guess who handed them to her a few days ago. something something something they kiss. they kiss some more. and they fall in love.
#the pitt#kingdon#langdonmel#melissa king#frank langdon#he has given her every color of daisies depending on the day#lately he’s been giving her a lot of red daises#which could mean nothing!!!!#need an au like this injected straight into my veins
60 notes
·
View notes
Text
No One Mourns the Wicked but nobody caring that Penny Lamb went missing. Except Ezra. No, one mourns the wicked.
#crowquill rtc#Maybe Tammy depending on your interpretation of her#I just got injected with Lambs angst juice#penny lamb#penny lamb legoland#penny legoland#ezra lamb#ezra lamb legoland#ezra legoland#legoland play#legoland musical#uranium teen scream trilogy#wicked 2024#wicked movie#wicked the musical#wicked#no one mourns the wicked
23 notes
·
View notes
Text
Chat I'm straight up not having a good time
#today started badly but like no biggie this is like 99% of my days these days#then i had to rush my cat to the vet only to be told he has diabetes#and now i have to start him on insulin injections twice a day#on top of checking his blood sugar all the time??#there's like 50-50 chance this is manageable on the long term#depending on how he responds to treatment#and it's just.....#there couldn't be a worse time for this#can i just give up. how can i apply to the giving up office
12 notes
·
View notes
Note
compensation :-]
CAN ANYBODY HEAR ME
#YELLING AND SCREAMING AND COUGHING AND SHITTING MYSELF OVE RTHIS#OH MY GODDD#HEEELEP HELP MEEEEE#FUCKING HEEEEEEELPPPP HHHHEEELPP#RAT. RAT. YOU’D BE A RAT. RAT. I THINK YOU’D BE A RAT. I THINK I’D BE A WOLF.#KING OF THE JUNJLE- THE JUNJLE#AUEHGGHHHHH#RIPPING MY HAIR OUT#WHAT ARE YOU ODING TO ME#LORD PLEASE IM ONLY 9 I WAS JUST BORN I WAS JUST PUT ON THIS EARTH IM SERIOUS#AAAAOEUGGHHHH#OF COURSE IT GOES WITHOUT SAYING THAT I AM HOPELESSLY DEPENDENT ON THE INGOT .#pleaas. what. wgat. what di you mean compensation i have a Bomb strapped to my back#Like i’m actually so sick of you#writing tags isnt enough i need to liquify this drawing and inject it into my veins#I LOVE IT SO BAD SERIOUS ART FROM ONE OF MY FAV ARTISTS LIKE DAMNNN OK I GUESS IMMA JUST NEVER BE NORMAL AGAIN#A WAYBACK AND A SLINKY ARE AN ANIMAL THAT ARE SO CUTES#FUCK ME THEY ARE BOTH SO FRIENDSHAPED I CANT TAKE ITTTTT AND YOU DREW HIS HALO AHHH#HEEELP HELPP MEEEE SOMEBODYYY ANYBODYYYYYYYY ANYBODY HEEEEELP#cramswering#is for me tag#oc: no way back#oc: slinky#ultimate fav#NEEDED TO ADD ALL THE TAGS BEFORE I RAN OUT LIKE A MADMAN. AUEHGGHHHH MY GOD YKU DREW THEM BOTH SO WELL IM RIPPING MYSELF APART#LIKE THIS IS NOT OK. NOT OK. DO U HEAR ME ? U CANT DO THIS TO ME. IM JUST A LITTLE GUY SERIOUS#SERIOUSSS GET OUT OF MY HEAD#AHHHH EVEYRTIMR I CLOSE THE TAGS TO GO LOOK AT IT AGAIN IT’S LIKE I GET BRAINBLASTED WITH AUTISM#IM NEVER GOING ON TUMBLR AGAIN SIMCARDIAC-ARRESTED WAS A SOCIAL EXPERIMENT THANKS EVERYONE#falls to the ground. starts digging the soil with my hands and then goes and lies there
55 notes
·
View notes
Text
PROGRAMMER OFFICE ETIQUETTE
✓ Acceptable: "This service is too large, and needs to be broken into smaller, more specialized services."
⚠ Potentially Acceptable: "I want to chop this service into pieces with a machete."
🛇 Not Acceptable, Apparently: "I want to chop this service into pieces with a machete and dispose of the chunks in half a dozen dumpsters so it's harder for the cops to investigate."
#as part of fixing this I learned that Spring will allow you to inject a reference to a class into that same class#this is of course a cyclical dependency also#a cycle of one entity#which exists in our code for some fucking reason#it's really relieving when I find that this kind of thing predates me#and thus I didn't sleepwalk through a code review and miss it
71 notes
·
View notes
Text
pebbles might have to be sedated tomorrow and I'm really trying to be okay about it
#I'm sure she'll be fine. I just get really scared when there's something not right with her.#especially recently I've been noticing how she's showing her age#they might not have to it depends if the swelling in her face has gone down by the morning#they gave her a 48h anti inflammatory injection which i think is helping#she doesn't seem to be in a lot of pain just some discomfort and she's been having difficulty eating#i just worry about her. that's my baby.
4 notes
·
View notes
Text
genuinely, signals & control flow & the inject function have taken angular from being a "meh it has it's uses but it's not great" UI framework to one of my favs in the space. the way you structure components now is so unbelievably different to when i started with it back at like v6 it's like an entirely new framework and honestly it's really fun to use. i'm actually looking forward to new releases since it always opens the door to new and interesting ways of doing something that's easier than before, and i actually want to make UIs with it instead of pining for something else
#i had a ui that i started for a project and that used solidjs#but some of that is annoying and confusing#esp with data fetching#but angular has the same signal concept but with fuckin dependency injection#and it works so seamlessly well together you'd think angular was made for it#surprisingly angular actually has less compiler magic than solidjs lol and i like that#it makes things easier to predict#oug i want to make something for myself using it#oh shit i have an idea actually#maybe i shall .......#lizabeth talkabeth#angular#javascript#typescript
2 notes
·
View notes
Text
would any of you give a shit if I wrote a fic with Shadow and my sona in it
#dark rambles#shadow the hedgehog#I think you guys would really like my sona. he’s an alien species whose ancestors believed injecting themselves with dragon blood would mak#-them immortal but instead it messed with their DNA so now they’re super powerful shapeshifters#depending on the continuity he’s also got weapons designed to inflict as much pain as possible while also being efficient and good defense
4 notes
·
View notes
Text
Exam hit me with two concept that I've literally never heard of (or at least never been explained to me).
"semantic html" -> the <> with things like "img" and other clearly-defined content to them.
"dependency injection" -> a method that receives objects, instead of creating them from scratch (aka, literally how all of our programming is done).
Thankfully, they only amount to 15% of the exam-result, so hopefully I'll still pass?
#school#personal stuff#semantic html feels like such a pointless thing to ask about? like. who cares what you call the damn things.#that's like going into english class and asking you to explain the official words for ''...'' or similar non-words#instead of asking you about HOW TO READ.#dependency injection is more of a wtf moment. bcs like... teach? did you not explain the word for this?#did you just use it randomly and fast-forward through it enough that nobody managed to actually ask what the words mean?#(he might've explained it. but i'm pretty sure it doesn't show up in our actual video-materials. so... who knows how that'll go.)#we also got an ''arrange these concepts in the order that they happen'' which was DEFINITELY not covered.#when the fuck were we talking about IP-addresses? hmm? when was DNS mentioned?#i mean i could guess some of the order from the context of it all. but others were wild guesses. so... that's fun.#sooo... yeah. some of the questions were a bit difficult and others were easy. and some of it were just... semantics that don't matter#which sounds about right. i think my teacher might be something of a moron? and hopefully we can rake him over the coals for this.#(though i suppose that depends on if my lack of ''proper studying'' means that i just ''missed things'' that others didn't)#(but like. if NOBODY answers some of those questions correctly? then i feel like we should take him to task for those questions)#(either for him not actually teaching us about those concepts. or bcs they shouldn't have been in the damn exam to begin with)
2 notes
·
View notes
Text
WIP Whenever
Tagged by the amazing @dear-massacre 💖
I've been drifting between two WIPs over the last month or so, but for the past week I've been heavily drawn into my college baseball au - where Theo is Derek's new teammate and Stiles is Theo's long-term boyfriend.
So - here's a bit of that! It's called striking out and will (hopefully) be posted to AO3 early in the new year.
-
“So," Derek says. "You and Theo. You’ve been together a – while, then?”
“Since sophomore year of high school,” Stiles replies, before snorting an inelegant laugh. “Was a pretty big shock even to me when I found myself actually saying yes to him asking me out.”
Derek’s eyebrows draw together. “What do you mean by that?”
“I just mean, I don’t know.” Stiles cuts off, mouth twisting around the words Derek can almost see whirring behind his forehead. The cluster of dorm buildings encroach into their line of sight. “I didn’t exactly… like him, in middle school. Or elementary school. Or kindergarten, for that matter.”
Derek’s eyebrows shoot up his forehead. “Why didn’t you like him?”
Stiles pauses, biting at his lip. There are goosebumps raised on the exposed part of his forearms, right around the jutting bone of his wrists, and he crosses his arms back over his chest again as a shiver wracks through his body. Derek lets himself list closer as they walk, just an inch, just in the hope that maybe he can impart even a little of his body heat, even if they’re still not quite touching.
“He was,” Stiles starts, trailing off like he’s looking for the right words, “not the… nicest guy, before high school.”
Derek takes that in for a second, narrowing his eyes and tipping his head sideways.
“Meaning – he was a bully,” he parses.
“Bully is a strong word,” Stiles defends instantly, and it sounds more than a little well-practiced. “He was a kid and kinda a jerk. I mean – who wasn’t a little asshole when they were twelve? He grew out of it by high school, is what matters.”
Derek bites back the huff of disbelieving laughter that wants to rip from his chest. He’s not sure it can be said that Theo has grown out of being a jerk now, by college, let alone high school. He won’t say this, though. Something tells him the guy’s devoted and adoring boyfriend probably won’t take it all that well.
“What did he do to win you over?” Derek presses. “Grand gesture at the big football game?”
“He stopped shoving me into lockers for a year and asked me out for curly fries.” Stiles shrugs a casual shoulder at the distressed look Derek shoots him. “I really like curly fries.”
“Right,” Derek says slowly. “I’m – starting to think bully might have been the right word, actually.”
Stiles rolls his eyes as he whirls to a stop in front of the door to a tall, grey building. They must have reached his dorm, Derek quickly guesses.
“It’s not as after school special as it sounds,” Stiles assures him. “I was a huge nerd. A lot of the sports guys liked shoving me in lockers in middle school. He’s just the only one that got the hots for me once I started to grow my hair out.”
“Very romantic,” Derek says drily. “I’m sure Hallmark will be asking for the rights in no time.”
#sterek#my fic#teen wolf#at the moment it's a bit of a race between whether this or nanny au will get finished first#it depends where my brain drags me ig#at the moment we're firmly here because i want to inject jealous!derek directly into my veins pretty much at all times
17 notes
·
View notes
Text
if you are 1) currently in a university where your student healthcare covers hormone therapy, and 2) in a good financial, emotional, and social position to start hormone therapy, i would recommend pursuing it. because in my experience, it's a huge pain in the ass to get an endocrinologist once you're on your own
#unless you live near a planned parenthood or another equivalent to that#but in general you might as well take advantage of the mandatory student health insurance while you have it#it's also cheaper than you might expect. my vials cost $40 CAD for 4 months and then the injection materials are like a couple dollars each#for me i got a therapist with the university and asked them to recommend me to one of the uni's doctors#so i got to skip some of the waitlisting process yay#and then even after getting access to hormones i went to the clinic maybe 5 or 6 times because i needed a nurse to help me with injections#all of which was 'free' because it was with the university#now that i'm graduated though i need to find a new endocrinologist and it turns out the process is WAY more complicated on your own 🤡#of course your mileage may vary depending on how based your school is but it's definitely worth checking imo 🤷#beepbeep.txt#wanted to say this because i basically didn't use the uni health services until my last year and i was like 'wow#'i'm actually getting so much shit for free right now'#like i was seeing a therapist and a dietician and the endocrinologist and a nurse simultaneously at one point#and i might've missed out on all that if i didn't have someone tell me how easy it was to get help if you ask the right questions#so there's my word of wisdom for anyone who might benefit from it.......#also going to post tips about injections later because i think that would also help people out 👍
27 notes
·
View notes
Text
saw someone say that if the webnovel version of s classes (856 chapters) is too intimidating, try reading the manhwa first to see if you'd be interested
which is extremely funny to me, a person who finds the manhwa way more lighthearted and also hated it so much i could barely get through the first 40 chapters
i mean honestly with the amount of humor injected into the manhwa and the way certain story arcs are rearranged (and added, in some cases), the manhwa seems like a completely different story to me.
#wwaffles bein' an idiot#my advice would be to pick one and stick with it and not worry about whats happening in the other#wwaffles reads sch#40 chapters may sound like a lot but its really not#a story is sometimes only properly established around that point depending on the pacing#i mean. its got over 800 chapters total (in the first part)#i dont remember for sure that it was 40 but it was around the time of the meeting with the guilds to establish the breeding center#i hated manhwa yj and as it turned out#it was because i was picking up on the manhwa injecting a weird sort of humor into him#that just doesnt exist in the novel
0 notes
Text
[ID from alt:
A graphic of various injections and what they look like inside the skin. The layers of the skin are depicted:
Epidermis
Dermis
Subcutaneous Tissue
Muscle
For Intramuscular Injections:
A needle is injected into the skin at a ninety degree angle and passes through every layer of skin right to the muscle. (layer four of the skin).
For Subcutaneous Injection:
A syringe is injected into the skin at a fourty-five degree angle and passes through the skin until it reaches the Subcutaneous Tissue of the body (layer three of the skin).
For intradermal injection:
A syringe is injected into the skin at a 10-15 degree angle and passes the epidermis until it reaches the dermis (layer two of the skin). end ID]
One of my biggest pieces of advice for those taking injectable hormones is to make sure you're injecting at the right angle
For intramuscular (IM), you inject at a 90° angle.
For subcutaneous (SQ), you inject at a 45° angle.
Here is a graphic depicting what the angle of your injection should look like:
An image description is provided in the ALT text.
#this also depends on the length of the needle. i do subQ shots of insulin sometimes and you can also get shorter needles! i do those 90°#took id out of alt and added the intradermal description bc alt isnt accessible to everyone who needs descriptions and the whole image-#should ideally be described#needles#happy injecting❣️
6K notes
·
View notes
Text
#best react native app development services#Best React Native Framework#Dependency injection in react native#effective react native state management strategies#React Native developer requirements#React Native development process#React Native development tools#React native installation step by step guide#React Native performance optimization#Tools Required for RN Development#Top applications using react native#top react native app development company
0 notes