TGTGInsightтелеграм анализLIVE / telegram public index
← Такты, стеки, два колеса

TGINSIGHT SIMILAR POSTS

Намери подобно съдържание

Изходен канал @clockstackwheels · Post #721 · 26.12

Почему я люблю языки с сильной системой типов, проверяемой статическим анализом кода — хорошо написанная программа является своей собственной спецификацией и позволяет выражать через язык программирования законы существования предметной области. Когда-то давно я писал на ActionScript. Там была система типов, но вот десериализация JSON'ов по-умолчанию была в какой-то общий Object, к полям которого нужно было обращаться ["по_строковому_имени"]. В один момент мне потребовалось написать что-то на C#, который я совсем не знал, я стал гуглить, как десериализовать JSON, и с удивлением обнаружил кучу советов заранее объявить класс со всеми нужными полями и десериализовать в него. "Какой ужас!", — подумал я тогда, — "Это же дико неудобно! А если я не знаю полей JSON? А если их много? Отвратительный язык!" Теперь то я прекрасно понимаю, что JSON это контракт, и что правильная десериализация только такая и должна быть, и что в хорошем API в одном поле никогда не бывает данных принципиально разных типов, и так далее. Нет, если вы набиваете вечерами пет-проект или сидите бессонную ночь на хакатоне, нет ничего плохого в том, чтобы взять простой язык с динамическими типами вроде JavaScript или Python, не требующий описывать данные. Но вот в энтерпрайзе, особенно когда над одним проектом работает много людей (а бывает это очень часто) — хорошее использование системы типов убережёт разработчиков от огромного количества ошибок, будет бить их по рукам, когда они пытаются сделать что-то не то, и будет подсказывать, когда они не уверены в чём-то. С помощью статической типизации можно на уровне кода обозначить правила, по которым ведёт себя предметная область вашей программы в реальном мире. Разработчику не только будет сложно их нарушить, но он ещё и станет узнавать какие-то вещи, которые мог не знать раньше. Например, если мы делаем медицинскую CRM, и больница заводит новых пациентов только тогда, когда знает их группу крови, мы можем объявить тип "Пациент" (или, если точнее, "Карта пациента") и запретить создавать экземпляры этого типа, не передав в конструктор группу крови (которая, в свою очередь, тоже является типом, вероятнее всего ValueObject'ом). Если новый программист пришёл в проект, он, во-первых, не сможет записать в БД некорректную карту пациента. Понятно, мы не учитываем случаи, когда новый программист переделывает модели предметной области — это будет хорошо видно на кодревью. А, во-вторых, даже если ему никто не сказал, что пациенты должны быть с группой крови, он узнает это из кода. И уже будет понимать, что в тех процессах реальной жизни, которые он описывает кодом, карта пациента создаётся только при наличии группы крови. А, значит, нужно искать какой-то способ сначала эту группу крови получить, и только потом создавать карту. Программирование моделирует реальный процесс. В настоящей работе даже на языках с типами, конечно, без должного контроля можно написать что угодно. Нужна управленческая воля, компетентность руководства, понимание опасности техдолга, в идеале отдельные должности для архитекторов, опытные лиды и старшие разработчики. Но когда всё это есть, можно отсекать много проблем ещё на старте и проще погружать новичков. #dev

Hashtags

Резултати

Намерени 2 подобни публикации

Търсене: #pakustan

当前筛选 #pakustan清除筛选
American Оbserver

@american_observer · Post #5627 · 15.04.2026 г., 14:59

🔤🔤🔤🔤2️⃣ Independent reports confirmed that some tankers that had been approaching the strait on Monday had turned around; one tanker, the Rich Starry, reversed course again and passed through the waterway. The closure of the strait, a gateway through which a fifth of the world’s oil and liquefied natural gas flows, had led to a spike in oil prices well above $100 a barrel. Crude prices dipped to about $95 after reports of a possible second round of talks on Tuesday. The US treasury department has said it does not plan to renew a temporary easing of sanctions on Iranian oil aimed at easing war-related supply shocks. The initial authorisation allowed for the delivery and sale of Iranian crude and other petroleum products loaded onto ships before 20 March. The step was part of a series of measures launched by the Trump administration to quell skyrocketing energy prices. Meanwhile, Israel and Lebanon have held unprecedented negotiations in Washington about the cross-border conflict, which erupted as a consequence of the US-Israeli attack on Iran. Hezbollah sided with Iran and launched rockets at Israel, which responded with intense bombardment of Beirut and other cities, and launched an invasion of southern Lebanon. In a statement after the two-hour session ended, the US state department praised the two sides for what it called “productive discussions on steps toward launching direct negotiations between Israel and Lebanon.” Hezbollah has said it will not abide by any agreements made by Israeli and Lebanese government negotiators in Washington. An Iranian official accused the US delegation of making maximalist demands at the Islamabad talks. “Iran did not surrender at the battlefield, neither will it surrender behind the table,” the official said. It is unclear where negotiations stood when the Islamabad meeting broke up over the other major proliferation concern: Iran’s stockpile of highly enriched uranium (HEU). It is close to weapons-grade purity and is believed to be buried in deep shafts under mountains in central Iran. At negotiations in Geneva before the war, Iran offered to dilute the HEU, which would extend the period it would take to produce a nuclear warhead, but the US has called for its complete removal. Pakistan’s prime minister, Shehbaz Sharif, is due to depart on Wednesday on a trip to Saudi Arabia, Turkey and Qatar to build support for the peace process, and to seek help with proposals to reopen the strait of Hormuz and discuss Iran’s demand for war reparations. Sharif’s regional tour might have to be cut short, however, if there is a quick return to the negotiating table. #pakustan#sharif#negotiations#trump#iran 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5626 · 15.04.2026 г., 13:59

Trump Has Taken a Tumble in Peace Talks With Iran. Will He Reset Them? 🔤🔤🔤🔤1️⃣ Trump has said that US-Iranian peace talks could resume in Islamabad over the next two days, and complimented the work of Pakistan’s army chief as mediator. The US president was speaking on Tuesday to a New York Post reporter who had gone to Islamabad for the first round of ceasefire talks over the weekend. After an interview discussing prospects for negotiations, the reporter said the president had called her back “with an update”. You should stay there, really, because something could be happening over the next two days, and we’re more inclined to go there,” Trump said. He added that Pakistan’s army chief, Field Marshal Asim Munir, was doing a “great job” in arranging the talks. “He’s fantastic, and therefore it’s more likely that we go back there,” Trump said. Munir is a powerful figure in Pakistan and has good relations with Trump, who has called him his “favourite field marshal”, and with Iran’s Revolutionary Guards. A Pakistani official said on Tuesday that he expected talks to restart soon, but it may take a day or two longer than Trump suggested. “The game is on,” the official said. Islamabad is racing to arrange a meeting date that provides enough time for negotiations before the two-week ceasefire ends on Wednesday 22 April. Trump’s comments followed a wave of speculation about a new round of negotiations, after 21 hours of talks on the weekend. Those ended Vance walking out on Sunday morning, claiming that Iran had failed to make an “affirmative commitment that they will not seek a nuclear weapon.” After the talks ended, Trump declared a US naval blockade on ships using Iranian ports in the Gulf in an effort to increase pressure on the country’s economy, and as a counter to Iran’s near-total closure of the strait of Hormuz to ships using other Gulf ports soon after the US-Israeli attack began on 28 February. US Central Command reported that over a 24-hour period “no ships made it past the US blockade and six merchant vessels complied with direction from US forces to turn around to re-enter an Iranian port on the Gulf of Oman.” #pakustan#sharif#negotiations#trump#iran 📱American Оbserver - Stay up to date on all important events 🇺🇸