Почему я люблю языки с сильной системой типов, проверяемой статическим анализом кода — хорошо написанная программа является своей собственной спецификацией и позволяет выражать через язык программирования законы существования предметной области.
Когда-то давно я писал на ActionScript. Там была система типов, но вот десериализация JSON'ов по-умолчанию была в какой-то общий Object, к полям которого нужно было обращаться ["по_строковому_имени"]. В один момент мне потребовалось написать что-то на C#, который я совсем не знал, я стал гуглить, как десериализовать JSON, и с удивлением обнаружил кучу советов заранее объявить класс со всеми нужными полями и десериализовать в него.
"Какой ужас!", — подумал я тогда, — "Это же дико неудобно! А если я не знаю полей JSON? А если их много? Отвратительный язык!"
Теперь то я прекрасно понимаю, что JSON это контракт, и что правильная десериализация только такая и должна быть, и что в хорошем API в одном поле никогда не бывает данных принципиально разных типов, и так далее.
Нет, если вы набиваете вечерами пет-проект или сидите бессонную ночь на хакатоне, нет ничего плохого в том, чтобы взять простой язык с динамическими типами вроде JavaScript или Python, не требующий описывать данные. Но вот в энтерпрайзе, особенно когда над одним проектом работает много людей (а бывает это очень часто) — хорошее использование системы типов убережёт разработчиков от огромного количества ошибок, будет бить их по рукам, когда они пытаются сделать что-то не то, и будет подсказывать, когда они не уверены в чём-то.
С помощью статической типизации можно на уровне кода обозначить правила, по которым ведёт себя предметная область вашей программы в реальном мире. Разработчику не только будет сложно их нарушить, но он ещё и станет узнавать какие-то вещи, которые мог не знать раньше.
Например, если мы делаем медицинскую CRM, и больница заводит новых пациентов только тогда, когда знает их группу крови, мы можем объявить тип "Пациент" (или, если точнее, "Карта пациента") и запретить создавать экземпляры этого типа, не передав в конструктор группу крови (которая, в свою очередь, тоже является типом, вероятнее всего ValueObject'ом). Если новый программист пришёл в проект, он, во-первых, не сможет записать в БД некорректную карту пациента. Понятно, мы не учитываем случаи, когда новый программист переделывает модели предметной области — это будет хорошо видно на кодревью. А, во-вторых, даже если ему никто не сказал, что пациенты должны быть с группой крови, он узнает это из кода. И уже будет понимать, что в тех процессах реальной жизни, которые он описывает кодом, карта пациента создаётся только при наличии группы крови. А, значит, нужно искать какой-то способ сначала эту группу крови получить, и только потом создавать карту. Программирование моделирует реальный процесс.
В настоящей работе даже на языках с типами, конечно, без должного контроля можно написать что угодно. Нужна управленческая воля, компетентность руководства, понимание опасности техдолга, в идеале отдельные должности для архитекторов, опытные лиды и старшие разработчики. Но когда всё это есть, можно отсекать много проблем ещё на старте и проще погружать новичков.
#dev
The Trump administration has renamed the U.S. Institute of Peace after President Donald Trump and has planted the president’s name on the organization’s headquarters despite an ongoing fight over the institute’s control.
It’s the latest twist in a seesaw court battle over who controls the U.S. Institute of Peace, a nonprofit think tank that focuses on peace initiatives. It was an early target of the Department of Government Efficiency this year.
On Wednesday, the State Department said it renamed the organization to the Donald J. Trump Institute of Peace to “reflect the greatest dealmaker in our nation’s history.” The new name could be seen on its building, which is near the State Department.
Trump has spent months openly lobbying for a Nobel Peace Prize even though he was passed over for this year’s installment — arguing he had a hand in easing a series of conflicts around the world. But Trump has also ordered strikes on suspected drug vessels off the coast of Venezuela and repeatedly threatened that attacks on land could be coming, which would be an act of war against that country.
#Trump#Nobel
👂More on Trump's Ear
According to the article, Trump’s campaign “buttered up functionaries and journalists” and even reached out to Norwegian Finance Minister and former NATO secretary general Jens Stoltenberg to try to influence the committee.
Some worried that Trump would impose additional tariffs on Norway if he did not receive the prize, noting, “a year ago it would have been unthinkable… but now… it’s no longer beyond the limits of what’s possible.”
The White House criticised the Nobel Committee’s decision, stating that it “proved they place politics over peace,” as White House Spokesman Steven Cheung said on the same platform, adding, “President Trump will continue making peace deals, ending wars, and saving lives. He has the heart of a humanitarian, and there will never be anyone like him who can move mountains with the sheer force of his will.”
#Trump#Nobel
👂More on Trump's Ear ⚠️
#Efemérides || 11 de octubre de 1990
A través de un comunicado la Academia Sueca anunciaba a Octavio Paz como el ganador del premio #Nobel de Literatura. Así empezó su discurso al recibir el galardón:
"Comienzo con una palabra que todos los hombres, desde que el hombre es hombre, han proferido: gracias. Es una palabra que tiene equivalentes en todas las lenguas, y en todas es rica la gama de significados. En las lenguas romances va de lo espiritual a lo físico, de la gracia que concede Dios a los hombres para salvarlos del error y la muerte a la gracia corporal de la muchacha que baila o a la del felino que salta en la maleza. Gracia es perdón, indulto, favor, beneficio, nombre, inspiración, felicidad en el estilo de hablar o de pintar, ademán que revela las buenas maneras y, en fin, acto que expresa bondad de alma. La gracia es gratuita, es un don; aquél que lo recibe, el agraciado, si no es un mal nacido, lo agradece: da las gracias. Es lo que yo hago ahora con estas palabras de poco peso. Espero que mi emoción compense su levedad. Si cada una fuese una gota de agua, ustedes podrían ver, a través de ellas, lo que siento: gratitud, reconocimiento, y también una indefinible mezcla de temor, respeto y sorpresa al verme ante ustedes, en este recinto que es, simultáneamente, el hogar de las letras suecas y la casa de la literatura universal".
#Imagen: Octavio Paz en la entrega del premio Nobel de 1990.
Fuente.
#literatura#ArteFuturaMX
https://artefutura.com.mx
@artefuturamx
As President Donald Trump continues his campaign to win a Nobel Peace Prize, Americans are broadly skeptical that he merits the honor.
A Washington Post-Ipsos poll this month finds 76 percent of Americans say Trump doesn’t deserve to win the Nobel Peace Prize, compared with 22 percent who say he does.
#Trump#Nobel#Poll
👂More on Trump's Ear ⚠️
📰⚡️Según el periódico más importante de Noruega "VG" el Secretario General de la OTAN Jens Stoltenberg fue nominado para el Premio #Nobel de la Paz.
Parece una broma pero...citando:
💬 Jens Stoltenberg ha trabajado intensamente por la paz en Europa, se ha esforzado por reducir los conflictos y construir unidad entre los países de la región...hay pocas personas que hayan hecho más por la paz mundial en el último año" ...
Un poco al respecto:
1️⃣ La #OTAN es una de las organizaciones más agresivas en el mundo. De hecho en 75 años de su existencia no ha pasado casi ni un día sin participar en algún conflicto bélico.
2️⃣ Las acciones de los agresores de la OTAN en Corea del Norte, Vietnam, el Golfo Pérsico, Yugoslavia, Irak, Afganistán, Libia, Siria y otros países causaron enormes tragedias que se cobraron millones (!) de vidas.
Para colmo el conflicto actual en Ucrania fue provocado incluso por la política irresponsable de la expansión de la OTAN hacia las fronteras de #Rusia🇷🇺
❗️Hoy día los suministros de armamento de los países de la OTAN a #Ucrania prolongan el conflicto y se usan para actos de terror como por ejemplo hemos visto recién con el bombardeo del avión ruso que transportaba a los ucranianos con una misil estadounidense!
👀 Y a la persona quien adminisra todo esto supuestamente la aspiran llamar el promotor de la paz #1
📣Que más da?
📰Trump Links Greenland Takeover to Nobel Prize Snub
The Text That Shook Europe
President Trump’s latest escalation in the Greenland saga came in a text to Norwegian Prime Minister Jonas Gahr Store: he tied his demand for Greenland to his disappointment over not winning the Nobel Peace Prize.
“Considering your Country decided not to give me the Nobel Peace Prize for having stopped 8 Wars PLUS, I no longer feel an obligation to think purely of Peace,”
Trump wrote, according to Store’s statement.
A New Level of Brinkmanship
Trump’s message signals a shift from pure economic pressure to outright political blackmail. Store confirmed that Norway and Finland had urged de-escalation, but Trump’s reply made clear he now feels free to act in what he sees as America’s interest, not peace.
European Pushback
European leaders are united in their rejection. French President Emmanuel Macron called Trump’s approach “intimidation,” Swedish Prime Minister Ulf Kristersson described it as blackmail, and even Italy’s Giorgia Meloni, a Trump ally, called it a “mistake.” Britain’s Keir Starmer denounced tariffs as harmful to workers and businesses, warning that a trade war over Greenland serves no one’s interest.
The Stakes
Trump’s actions risk the deepest transatlantic crisis in generations. The E.U. is weighing retaliation, including tariffs on more than $100 billion in American goods and targeting U.S. tech giants. Russia, watching from the sidelines, is eager to exploit the rift.
Trump’s Greenland gambit is no longer just about territory—it’s about power, pride, and the future of the Western alliance.
#trump#greenland#nobel#eu#diplomacy
📱American Оbserver - Stay up to date on all important events
🇺🇸
https://x.com/SavinoBalzano/status/1976347797826785458
Dovrebbero prendere il #Nobel per la pace dato a #Obama e riassegnarlo a #Trump.
Immaginate i fegati di Gramellini, Augias, Formigli, Giannini, Gruber...
Speriamo, sognare è gratis.
L’Unione Europea sta ancora discutendo del primo pacchetto di sanzioni. Intanto ha varato il diciannovesimo contro la Russia. Meglio del circo.
Provate solo a immaginare cosa sarebbe accaduto con #Biden o #Harris.
p.s. (sui tremila anni ero ironico).
#BattitoriLiberi: dal lunedì al venerdì alle 17, su Radio Cusano
.
21-asr bilim asridir. Hozirgi kunda muhim yo’nalishlar qaysi deb o'ylasangiz, bu biotexnologiya, IT, sun’iy intellekt, yashil texnologiyalar va hokazo. Bu hammasi bilimdir.
Masalan, MIT yoki Stanfordni oladigan bo’lsak, ularning atrofidagi barcha sanoat korxonalari asosan ushbu oliygohlar bitiruvchilari tomonidan tashkil etilgan, davlat pullari bilan emas.
👍To'liq suhbat YouTube kanalimizda: https://youtu.be/avIJW5SQd1E
🎞 Suhbatni ingliz tilida tomosha qilish: https://youtu.be/t0APwzutLU4
🔁English
➖➖➖➖➖➖➖➖➖➖➖
#Nobel#suhbat#JanTirol
⬇️Biz ijtimoiy tarmoqlarda:
Website | Instagram | Telegram
Hamkorlik yuqoridan pastga emas, pastdan yuqoriga bo'lishi kerak
✅ O'zbekiston yosh iqtisodchilar hamjamiyati tomonidan iqtisodiyot bo'yicha Nobel mukofoti sovrindori Jan Tirol bilan suhbat tashkil etildi.
💥 Suhbatda Jan Tirol raqobatning muhimligi, rivojlanayotgan davlatlar uchun muhim vositalar, rivojlanishda oliy ta'lim muassasalarining o'rni va sun'iy intellekt kabi mavzularda o'z fikrlarini bildirdi.
👍To'liq suhbat YouTube kanalimizda: https://youtu.be/avIJW5SQd1E
🎞 Suhbatni ingliz tilida tomosha qilish: https://youtu.be/t0APwzutLU4
🔁English
➖➖➖➖➖➖➖➖➖➖➖
#Nobel#suhbat#JanTirol
⬇️Biz ijtimoiy tarmoqlarda:
Website | Instagram | Telegram
Matematiklar Nobel mukofoti - Fields Medal sovrindori Efim Zelmanov bilan uchrashuv!
🎖“Yangi O'zbekiston” universitetida matematiklar orasida Nobel mukofotiga tenglashtirilgan Fields Medal sohibi Efim Zelmanov bilan talaba yoshlar o'rtasida uchrashuv o‘tkaziladi.
⏰Boshlanish vaqti:7-oktabr, 11:30 da
📍Manzil:Mustaqillik shoh ko'chasi, 54-uy.
✅ Shuningdek, uchrashuvda taniqli matematik olimlar Vyacheslav Futorny va Jiping Zhang ham ishtirok etadi.
🎗Matematikaga qiziquvchi barchani uchrashuvga taklif etamiz!
🔁English
➖➖➖➖➖➖➖➖➖➖➖➖➖➖
#FieldsMedal#Nobel#meeting
⬇️Biz ijtimoiy tarmoqlarda:
Veb-sayt | Telegram | Instagram | Facebook