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 подобни публикации

Търсене: #chagos

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

@american_observer · Post #4903 · 20.01.2026 г., 13:59

Trump Called the UK “very stupid” Trump has suggested Britain’s decision to cede the Chagos Islands to Mauritius is among the reasons he wants to take over Greenland. The US president, who is travelling to Davos in Switzerland for the World Economic Forum, made the claim as he ramped up his rhetoric on acquiring the Arctic territory. Trump fired off a flurry of posts on his Truth Social platform overnight on Tuesday about taking over Greenland, which is a territory of Denmark, the US’s Nato ally. Writing on the website, Trump said “Shockingly, our “brilliant” Nato Ally, the United Kingdom, is currently planning to give away the Island of Diego Garcia, the site of a vital US Military Base, to Mauritius, and to do so FOR NO REASON WHATSOEVER. “There is no doubt that China and Russia have noticed this act of total weakness. These are International Powers who only recognise STRENGTH, which is why the United States of America, under my leadership, is now, after only one year, respected like never before. “The UK giving away extremely important land is an act of GREAT STUPIDITY, and is another in a very long line of National Security reasons why Greenland has to be acquired.” The move will come as a huge shock to No 10 after the US secretary of state, Marco Rubio, gave his warm endorsement of the handover when it was first approved. It will also add fuel to Conservative and Reform criticisms of the move, which have cited US concerns as a reason to deny the deal with Mauritius. Immediately after Trump’s comments, the shadow foreign secretary, Priti Patel, said: “President Trump has said what we’ve said all along – Labour’s £35bn Chagos surrender is a bad deal for Britain and bad for our national security. We’ve opposed it from day one and it’s time Starmer put the security of our country first and scrap his rotten deal.” Nigel Farage, the Reform UK leader, said: “Thank goodness Trump has vetoed the surrender of the Chagos islands.” The UK has signed a £3.4bn agreement to cede sovereignty over the Chagos Islands to Mauritius but the deal is facing significant opposition in the House of Lords. On Monday, the MP Andrew Rosindell, who defected from the Conservatives to Reform UK, cited a failure to stand up for the Chagos Islands as a major factor in leaving the party. At the time of the agreement in May 2025, Rubio said the US “welcomed the historic agreement”. It went on : “This is a critical asset for regional and global security. President Trump expressed his support for this monumental achievement during his meeting with prime minister Starmer at the White House. “This milestone reflects the enduring strength of the US-UK relationship.” Critics of the handover have said the deal gives China an opening in the region because of its close relations with Mauritius. Trump has regularly cited fears of Chinese influence as a reason he intends the US to take over Greenland. #trump#britain#mauritius#chagos 📱American Оbserver - Stay up to date on all important events 🇺🇸

Communia

@communia · Post #37437 · 28.10.2023 г., 12:11

La descolonización de las #Chagos a favor de las islas #Mauricio, aliado de #China, cada vez más en duda en #GranBretaña. La posibilidad de un golpe de estado en #Mauricio es más cercana que las supuestas implicaciones sobre #Malvinas. Aunque la conexión existe: si #China abre una base militar en el #Índico Occidental, la siguiente «perla del collar» tiene que estar en las proximidades del #MardeHoces... «El Reino Unido se encuentra en medio de una creciente controversia con graves implicaciones internacionales. La disputa gira en torno a las islas Chagos, un territorio británico de ultramar en el océano Índico. Recientes advertencias han surgido, alegando que un posible traspaso de estas islas a M#auricio, un aliado de China, podría poner en peligro la seguridad nacional británica y abrir las puertas a un cuestionamiento de la soberanía de las Islas Malvinas. Un informe del think tank Policy Exchange advierte de los riesgos de ceder las islas Chagos a Mauricio. Estas alegaciones surgieron después de que el ex primer ministro Boris Johnson acusara a su propio Gobierno de prepararse para cometer “un error colosal” al transferir la propiedad de Chagos a Mauricio. El ex primer ministro informó de que “fuentes” le habían informado de que el gobierno está dispuesta a firmar un acuerdo para transferir la propiedad del archipiélago de Chagos a Mauricio.» https://www.escenariomundial.com/2023/10/27/desde-el-reino-unido-se-encienden-las-alarmas-por-la-disputa-de-chagos-y-su-impacto-en-malvinas/