Почему я люблю языки с сильной системой типов, проверяемой статическим анализом кода — хорошо написанная программа является своей собственной спецификацией и позволяет выражать через язык программирования законы существования предметной области.
Когда-то давно я писал на ActionScript. Там была система типов, но вот десериализация JSON'ов по-умолчанию была в какой-то общий Object, к полям которого нужно было обращаться ["по_строковому_имени"]. В один момент мне потребовалось написать что-то на C#, который я совсем не знал, я стал гуглить, как десериализовать JSON, и с удивлением обнаружил кучу советов заранее объявить класс со всеми нужными полями и десериализовать в него.
"Какой ужас!", — подумал я тогда, — "Это же дико неудобно! А если я не знаю полей JSON? А если их много? Отвратительный язык!"
Теперь то я прекрасно понимаю, что JSON это контракт, и что правильная десериализация только такая и должна быть, и что в хорошем API в одном поле никогда не бывает данных принципиально разных типов, и так далее.
Нет, если вы набиваете вечерами пет-проект или сидите бессонную ночь на хакатоне, нет ничего плохого в том, чтобы взять простой язык с динамическими типами вроде JavaScript или Python, не требующий описывать данные. Но вот в энтерпрайзе, особенно когда над одним проектом работает много людей (а бывает это очень часто) — хорошее использование системы типов убережёт разработчиков от огромного количества ошибок, будет бить их по рукам, когда они пытаются сделать что-то не то, и будет подсказывать, когда они не уверены в чём-то.
С помощью статической типизации можно на уровне кода обозначить правила, по которым ведёт себя предметная область вашей программы в реальном мире. Разработчику не только будет сложно их нарушить, но он ещё и станет узнавать какие-то вещи, которые мог не знать раньше.
Например, если мы делаем медицинскую CRM, и больница заводит новых пациентов только тогда, когда знает их группу крови, мы можем объявить тип "Пациент" (или, если точнее, "Карта пациента") и запретить создавать экземпляры этого типа, не передав в конструктор группу крови (которая, в свою очередь, тоже является типом, вероятнее всего ValueObject'ом). Если новый программист пришёл в проект, он, во-первых, не сможет записать в БД некорректную карту пациента. Понятно, мы не учитываем случаи, когда новый программист переделывает модели предметной области — это будет хорошо видно на кодревью. А, во-вторых, даже если ему никто не сказал, что пациенты должны быть с группой крови, он узнает это из кода. И уже будет понимать, что в тех процессах реальной жизни, которые он описывает кодом, карта пациента создаётся только при наличии группы крови. А, значит, нужно искать какой-то способ сначала эту группу крови получить, и только потом создавать карту. Программирование моделирует реальный процесс.
В настоящей работе даже на языках с типами, конечно, без должного контроля можно написать что угодно. Нужна управленческая воля, компетентность руководства, понимание опасности техдолга, в идеале отдельные должности для архитекторов, опытные лиды и старшие разработчики. Но когда всё это есть, можно отсекать много проблем ещё на старте и проще погружать новичков.
#dev
🚨 16-year-old, Yousef Kaabneh ascended to martyrdom, after he was shot and killed by the IOF near the town of Jiljiliya, north of #Ramallah.
Yousef ascended in defense of his homeland amidst the settler and IOF invasion of his land.
Coinciding with his martyrdom, settlers launched attacks on the western areas of Sinjil and Jiljiliya:
• Four Palestinians were injured — two by live fire and two as a result of severe beatings.
• Settlers looted approximately 700 sheep and agricultural equipment belonging to local farmers in the area under the protection of the IOF.
Glory to the martyrs.
The occupation released the activist Abu al-Sabe' Qatash who is now in critical health, bearing visible signs of beating and torture.
Qatash was detained hours earlier while confronting a settler attack on his village, Yabrud, in #Ramallah.
🚨 16-year-old, Yousef Kaabneh ascended to martyrdom, after he was shot and killed by the IOF near the town of Jiljiliya, north of #Ramallah.
Yousef ascended in defense of his homeland amidst the settler and IOF invasion of his land.
Coinciding with his martyrdom, settlers launched attacks on the western areas of Sinjil and Jiljiliya:
• Four Palestinians were injured — two by live fire and two as a result of severe beatings.
• Settlers looted approximately 700 sheep and agricultural equipment belonging to local farmers in the area under the protection of the IOF.
Glory to the martyrs.
Ramallah's Revenge - The Ein Bubin Operation:
On August 23, 2019, comrades of the Popular Front for the Liberation of Palestine rose through the ashes of Oslo, dismantling illusions of peace upheld by the PA's security services to restore the era of fida'i operations, tearing apart the false sense of security imposed by the occupation and its collaborators.
Near Deir Ibzi' in #Ramallah, five comrades executed a complex operation that resulted in the killing of an extremist rabbi and the wounding of two settlers, including an IOF officer, with a PFLP-manufactured explosive. The rabbi had hesitated greatly before entering the area, a natural water spring used by local Palestinian villagers, and called upon the IOF for protection.
The heroes Samer Al-Arabid, Yazan Mughamis, Qassam Al-Barghouti, Nizam Amter, and Walid Hanatsheh defied this illusion of protection, targeting the settlers strolling through land not theirs.
The operation was a significant blow, not just in terms of its immediate impact, but in its broader implications. It shattered the myth of the recently unveiled "israeli"-American "deal of the century," upending the occupation's plans for expansion and theft of Palestinian resources. The resistance demonstrated that even in the heart of Ramallah, a symbol of the PA's security cooperation, the spirit of armed struggle is alive.
This was not the first time that Ein Bubin witnessed the fire of resistance. The spring situated west of Ramallah is a microcosm of the larger struggle: In 2015, fighter and prisoner Mohammed Abu Shahin carried out a shooting operation there, killing a settler and wounding another. Zionists renamed it "Ein Dani" after the killed settler, but his memorial has been repeatedly destroyed by local Palestinians.
The Ein Bubin operation also highlighted the technical expertise and organizational capacity of the PFLP, which was and still is feared by the IOF. The occupation, hoping this was an isolated incident, soon realized that this was part of a larger, organized cell. Their panic was palpable as they resorted to brutal interrogation techniques and torture against the five comrades, but failed to break their resolve. The IOF abducted 40 Palestinians, mostly students and activists, and tortured many. In this time, the cell carried out two more shooting operations.
Samir Arabid and Walid Hanatsheh were subjected to extreme torture, with Samir's bones broken and Walid's legs and feet turning black due to abuse in 23-hour-long daily interrogations. Samir, accused of leading the cell, lost his hearing and suffered from kidney failure due to torture. Walid, along with Secretary-General Ahmed Saadat, was subjected to isolation and prison transfers in the summer of 2023 following the "Beitar Illit" operation.
More broadly, the "Ein Bubin" operation was a direct challenge to the socio-political order imposed by the occupation and its collaborators, at a time when operations were less frequent. The heroes reminded the world that the struggle for Palestine is not just about land but about dignity, identity, and the right to resist oppression. As the occupation escalated its efforts to crush the resistance, it became clear that the "Ein Bubin" operation had a greater impact, reigniting the spirit of resistance in a time of despair and proving the will to fight could not be extinguished by years of occupation or by the illusions of peace processes.
Further, the operation is a model of the revolutionary student fighter. In honor of the operation, the PFLP's student bloc at Birzeit announced heroic prisoner Yazan Mughamis as its chairman last year, as he was its Deputy Secretary in 2019. This coincided with a commemoration of the operation, where its heroes were honored under the model of "Intellect and Rifle."
The five heroes, their homes demolished by the IOF, now endure the occupation’s prisons, serving life sentences for their heroic acts, undeterred. Their legacy, however, proves that resistance is a continuous benefit, as students, fighters, and workers vow to continue their path.
🚨 The IOF arrested 6 children during a raid on the town of Beit Ummar, north of #AlKhalil, according to local sources.
Separately, the Palestine Red Crescent Society reported that medical teams are treating a 21-year-old man who sustained gunshot wounds to the thigh and back from "israeli" occupation forces fire in Birzeit, north of #Ramallah.
🚨Summary of settler attacks in the West Bank over the past 24 hours:
• A settler attempted to run over a Palestinian woman near Al-Minya village, east of #Bethlehem.
• Settlers uprooted a large number of olive trees in the Wadi Musa area of Turmus Ayya, north of #Ramallah.
• Settlers attempted to block farmers from plowing their lands in the plains of Turmus Ayya.
• Settlers erected a tent near citizens' homes by the Carmelo roundabout near Al-Taybeh village, east of #Ramallah.
• Settlers released livestock in the vicinity of Palestinian homes in Susya village, Masafer Yatta, south of #AlKhalil.
• Settlers stormed Kafr Malik village, northeast of #Ramallah.
• Settlers attacked farmers and blocked access to their lands in the Ghuraba area, northwest of Sinjil village, north of #Ramallah.
• Settlers cut down and uprooted 400 centuries-old olive trees in the lands of Qusra, south of #Nablus.
• Settlers released livestock onto farmers' lands in Khirbet Al-Tawil, east of Aqraba, south of #Nablus.
🚨Summary of settler attacks in the West Bank over the past 24 hours:
• A settler attempted to run over a Palestinian woman near Al-Minya village, east of #Bethlehem.
• Settlers uprooted a large number of olive trees in the Wadi Musa area of Turmus Ayya, north of #Ramallah.
• Settlers attempted to block farmers from plowing their lands in the plains of Turmus Ayya.
• Settlers erected a tent near citizens' homes by the Carmelo roundabout near Al-Taybeh village, east of #Ramallah.
• Settlers released livestock in the vicinity of Palestinian homes in Susya village, Masafer Yatta, south of #AlKhalil.
• Settlers stormed Kafr Malik village, northeast of #Ramallah.
• Settlers attacked farmers and blocked access to their lands in the Ghuraba area, northwest of Sinjil village, north of #Ramallah.
• Settlers cut down and uprooted 400 centuries-old olive trees in the lands of Qusra, south of #Nablus.…
🚨 The IOF and armed settlers conducted a series of aggressions across the West Bank today:
Armed settlers attacked farmers in the village of Al-Mughayyir in #Ramallah and prevented them from harvesting olives. (media 1,2) Settlers also cut down olive trees in the village of Yasuf, east of #Salfit (media 3,4).
The IOF invaded the town of Beita, south of #Nablus, where confrontations erupted between resistance youth and the zionist forces. (media 5,6,7).
The IOF fired live bullets heavily at Palestinian homes at the entrance of Al-Arroub refugee camp, north of #AlKhalil. (media 8,9)
The IOF invaded Shufat refugee camp in #AlQuds. (media 10)