paint-brush
I-Frameworks Dilemmange@luminousmen
815 ukufundwa
815 ukufundwa

I-Frameworks Dilemma

nge luminousmen7m2024/09/26
Read on Terminal Reader

Kude kakhulu; Uzofunda

Njengonjiniyela, izinhlaka zivame ukuba yinto yokuqala oyibambayo lapho ufuna ukusheshisa izinto futhi ugcine izinto zithembekile.
featured image - I-Frameworks Dilemma
luminousmen HackerNoon profile picture

Njengonjiniyela, izinhlaka zivame ukuba yinto yokuqala oyibambayo lapho ufuna ukusheshisa izinto futhi ugcine izinto zithembekile. Abantu bavame ukukhuluma ngezinhlaka njengokuthi ziyisixazululo esiphelele esingalungisa zonke izinkinga zakho, senze intuthuko isheshe, ibe lula, futhi isebenze kahle. Kodwa-ke, uma uke waba nolwazi oluthile ngaphansi kwebhande lakho, uyazi ukuthi izinhlaka azisona isixazululo esilingana konke. Ukukhetha okulungile kungenza umsebenzi wakho ube lula, kodwa ukukhetha okungalungile kungaholela ekuphathweni ikhanda phansi komgwaqo, kukubambezele lapho udinga ukuhamba ngokushesha.


Kulokhu okuthunyelwe kwebhulogi, sizongena ezinseleleni zangempela namasu afika nokukhetha nokusebenzisa izinhlaka. Sizobheka izingibe ezingaba khona, ukuthi ungazigwema kanjani, nezindlela zokugcina i-codebase yakho ivumelana nezimo — nanoma uhlaka ludlala.

Ubudlelwano Ubungazi Ukuthi Uyangena Kubo

Ukuzibophezela ohlakeni kufana nokungena ebudlelwaneni besikhathi eside. Futhi akuyona into yokuthatha kalula. Ngokungafani nomtapo wezincwadi olula noma insiza encane, izinhlaka ziza nemibono - eminingi yayo. Baphoqelela ukwakheka kanye nendlela yokwenza kuhlelo lwakho lokusebenza, noma uyathanda noma awuthandi.


Ukuzibophezela Kwesikhathi Eside Kwezinhlaka


Kubalulekile ukukhumbula ukuthi abadali bohlaka banezabo eziza kuqala. Baxazulula izinkinga zabo, hhayi ezakho. Abakweleti lutho (ngaphandle uma, kunjalo, unomngane wethimba lohlaka lwangaphakathi, uma kunjalo, unenhlanhla). Uma izinto ziya eningizimu, ikakhulukazi kuphrojekthi yakho, ungaba sezweni elibuhlungu. Manje ubambekile ekuyilungiseni, noma okubi nakakhulu, ukuyikhipha ngokuphelele.


Akumnandi, akunjalo?


Ngakho-ke ngaphambi kokuthi uzibophe ohlakeni, qiniseka ukuthi luhambisana nalokho okudingayo. Uma kungenjalo, ugingqa idayisi.

FAANG Izinkinga

Umbhali akazi ukuthi i-FAANG yaba i-MAANG, i-MANGA, noma uma sonke siku-anime manje.

Nakhu lapho ukuzizwisa kubaluleke khona. Lapho izinkampani zikhula ngokushesha, zivame ukubhekana nezinselele okungekho sixazululo esingakwazi ukuzisingatha. Izinga lalezi zinkinga liziphoqa ukuthi zenze amathuluzi azo - isizindalwazi sangokwezifiso, izinjini ze-ETL, amathuluzi e-BI - ukusho lokho. Iziqhwaga ezinkulu ze-Big Tech ezifana ne-Google, i-LinkedIn, i-Spotify, ne-Netflix zihole indlela, ukwakha kanye namathuluzi omthombo ovulekile esizodlala ngawo sonke.


Kodwa nansi into: lawa mathuluzi awazange akhelwe ukuthi asebenze emhlabeni wonke. Zadalelwa ukuxazulula izinkinga ezithile izinkampani eziningi ezingasoze zahlangabezana nazo. Onjiniyela abake basebenza kulezi zinkampani ezinkulu bajwayele ukubhekana nalezi zinselelo - bakhe izixazululo ezisebenza ngezinga iningi lethu elingacabanga ngalo. Ngakho-ke lapho bethuthela ezinkampanini ezincane, uhlaka nezinqumo zamathuluzi abazenzayo zisekelwe ekuqondeni okujulile kokubili amandla nezingibe zalobu buchwepheshe.

Pushback Against Frameworks

Muva nje, kuke kwaba nokuhlubuka kancane—abantu sebekhathele yizinhlaka. Ikakhulukazi emhlabeni we-JavaScript, abathuthukisi bakhathele ukuxokozela njalo. Cishe usuyibonile: njalo uma isibuyekezo esikhulu sehla, kufanele ubhale kabusha izingxenye ezibalulekile ze-codebase yakho ukuze nje uhlale ubalulekile. Futhi ungangiqalisi emjikelezweni ongapheli wokushintsha izinguquko.


Lokhu kukhungatheka kubangele ukuvuselelwa kwezitaki ezilula, ezizinzile. Izinto ezifana ne-vanilla HTML, CSS, jQuery, PHP, kanye ne-SQLite ziyabuya phakathi konjiniyela ababeka phambili ukwenza izinto kuqhubeke nokuhlala onqenqemeni lokopha kwezobuchwepheshe. Yebo, kungase kuzwakale "isikole esidala," kodwa kusekude nesikhathi. Ngestaki esilula, ungakwazi ukuphindaphinda ngokushesha futhi uthumele ngokushesha okukhulu. Impela, izinhlaka ezintsha ezifana ne-React, Node.js, ne-Flask zinendawo yazo, kodwa ngezinye izikhathi awuzidingi zonke izinto zikanokusho. Kwesinye isikhathi, ukunamathela kulokho okusebenzayo kungakusindisa izinhlungu zekhanda eziningi.

I-Framework Industrial Complex?

Ingabe izinhlaka ziya... ziyaqina? Kunzima ukungaboni ukuthi ezinye izinhlaka zizwakala njengamathuluzi aklanyelwe ukuheha uxhaso lwe-VC kunokuxazulula izinkinga zangempela zonjiniyela. Kufana nokuthi kune-ecosystem yonke ephusha onjiniyela kulezi zinhlaka, ukuze babone kamuva ukuthi, uma sebelinganisa, bavaleleke ezinkundleni ezimba eqolo. Impela, izinhlaka ezifana neDatabricks ziwumthombo ovulekile futhi zikhululekile ukuqala ngazo, kodwa njengoba ukhula, ubhekelwa ezisombululweni zazo zebhizinisi. Futhi ngokuzumayo, izindleko zakho zokubamba nezokusebenza zidlula ophahleni, kuyilapho i-VPS elula ingase yanele.


Kuzwakala sengathi yisicupho, akunjalo?

Ukubambezeleka Kwesinqumo Sohlaka

Nasi iseluleko engifunga ngaso: ungajahi ukukhetha uhlaka . Ungazibophezeli kuze kube yilapho i-architecture yakho isiphelele ngokuphelele.


Uhlaka kufanele kube yinto yokugcina okhathazeka ngayo, hhayi eyokuqala.


Okokuqala, qiniseka ukuthi i-architecture yakho iqinile. Yazi izingxenye zakho ezibalulekile nokuthi zizosebenzisana kanjani. Uma usuthole lokho, ungahlola izinhlaka ngokuqonda okucacile kokuthi zingangena kuphi - noma uma zingena nhlobo.


Le ndlela iqinisekisa ukuthi umklamo wakho uqinile futhi uhambisana nezidingo zakho ezithile. Uma kufika isikhathi sokucabangela uhlaka, uzokwazi ukubona ngokucacile lapho lungathuthukisa khona ukwakheka kwakho ngaphandle kokulikhawulela.


Ngaphambi kokuthi ungene ekusebenziseni noma yiluphi uhlaka, zibuze: ingabe uludinga ngempela? Impela, izinhlaka zingangeza izendlalelo zokuzenzakalela nokuba lula, kodwa futhi ziza nesethi yazo yemikhawulo. Uma isicelo sakho sinezidingo ezihlukile, izinhlaka zingase zingadlali kahle ngazo.


Cabanga isikhathi eside futhi kanzima mayelana nezinzuzo zesikhathi eside ngokumelene nemikhawulo.

Ukwenza Izinhlaka Zisebenzise Imali

Uma unquma ukuthi uhlaka luyifanele ingozi, qiniseka ukuthi kulula ukulishintsha. Yebo, ukuzwile kahle lokho. Yakha kokunye ukuguquguquka ukuze kuthi uma udinga ukukuyeka kamuva, akuwona umsebenzi omkhulu. Nansi indlela:

Abstract Ukuxhomekeka Kwakho

Gcina izandla ezincane zohlaka zingangeni kukhodi yakho ewumgogodla. Sebenzisa izixhumi ezibonakalayo ukuze ukhiphe ukusebenza kohlaka ukuze ingqondo yebhizinisi lakho inganciki kuhlaka ngokuqondile.


Ake sithi usebenzisa i-TensorFlow ekufundeni komshini. Esikhundleni sokushumeka ikhodi ye-TensorFlow kulo lonke uhlelo lwakho lokusebenza, chaza ukuxhumana ukuze ugcine izinto zicocekile futhi zingabonakali:

 from abc import ABC, abstractmethod import tensorflow as tf class ModelTrainer(ABC): @abstractmethod def train(self, data): pass class TensorFlowTrainer(ModelTrainer): def train(self, data): # TensorFlow-specific training logic model = tf.keras.models.Sequential([...]) model.compile(optimizer='adam', loss='sparse_categorical_crossentropy') model.fit(data, epochs=5) return model


Ngokwenza lokhu, ingqondo yakho eyinhloko ayihlanganiswe ngokuqinile ne-TensorFlow. Uma udinga ukushintshela kolunye uhlaka lokufunda lomshini, kuyindaba nje yokushintsha ukuqalisa.

I-Dependency Injection (DI) inguMngane Wakho

Okulandelayo, ake sikhulume nge-Dependency Injection (DI). Le nqubo ikuvumela ukuthi ujove ukusetshenziswa okuthile kokuhlangana kwakho emakilasini akho, ugcine i-codebase yakho ihlukanisiwe futhi i-modular.

 class TrainingPipeline: def __init__(self, trainer: ModelTrainer): self.trainer = trainer def execute(self, data): return self.trainer.train(data) # Inject the TensorFlowTrainer implementation pipeline = TrainingPipeline(TensorFlowTrainer())


Manje ikhodi yakho iyavumelana nezimo, kulula ukuyihlola, futhi ilungele noma yini ikusasa eliyiphonsayo.

I-Embrace Inversion of Control (IoC)

Ukuze uthole ukuguquguquka okukhulu, thatha izinto phezulu nge-Inversion of Control (IoC). Le phethini ikuvumela ukuthi ucacise ukusetshenziswa kufayela lokumisa noma indawo emaphakathi kukhodi yakho. I-cherry engaphezulu kwe-framework-agnostic architecture.


Nasi isibonelo sokuthi lokho kungase kusebenze kanjani ngendlela esekelwe ekucushweni:

 # config.py class Config: TRAINER = 'my_project.trainers.TensorFlowTrainer' # main.py import importlib class TrainingPipeline: def __init__(self, trainer_class: str): module_name, class_name = trainer_class.rsplit('.', 1) module = importlib.import_module(module_name) trainer_cls = getattr(module, class_name) self.trainer = trainer_cls() def execute(self, data): return self.trainer.train(data) # Inject the trainer specified in the configuration from config import Config pipeline = TrainingPipeline(Config.TRAINER)


Manje, uma kwenzeka udinga ukufaka esikhundleni se-TensorFlow ngolunye uhlaka lokufunda lomshini, uvele ubuyekeze ukucupha futhi uqhubeke. Akunankinga, akukho drama.

Isiphetho

Khumbula, izinhlaka kufanele zisebenzele i-architecture YAKHO, hhayi ukuyiyalela. Ngokuhlela okucophelelayo kanye nokukhipha amasu, ungathola izinzuzo zezinhlaka ngaphandle kokubanjiswa ukuncika kwesikhathi eside. Iqhinga lihlala lilawula. Ngakho-ke ngokuzayo lapho usuzongena ohlakeni, thatha isinyathelo emuva futhi uzikhumbuze: ubiza amashothi lapha.


Ulungele ukulimala


Siyabonga ngokufunda!


Noma yimiphi imibuzo? Shiya amazwana akho ngezansi ukuze uqale izingxoxo ezimnandi!


Bheka ibhulogi yami noma uzothi sawubona 👋 ku -Twitter noma ubhalisele isiteshi sami socingo . Hlela okusemandleni akho!