python |
Pythonタグが付けられた新着投稿 - Qiita |
【Python】単ページのPDFを見開きで結合する方法 |
https://qiita.com/yusuke_s_yusuke/items/c0ab5b24bff9bbf86116
|
ffrompypdfimportpdfwriter |
2023-01-03 01:04:41 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
App Service 証明書の有効期限を Azure Functions を使用して監視する(2022年12月版) |
https://qiita.com/shogo-ohe/items/fd1ae6f66644f246edfd
|
appservic |
2023-01-03 01:50:18 |
海外TECH |
DEV Community |
17 Compelling Reasons To Start Ditching TypeScript Now. |
https://dev.to/wiseai/17-compelling-reasons-to-start-ditching-typescript-now-249b
|
Compelling Reasons To Start Ditching TypeScript Now If you re anything like me you re probably using Typescript because you were forced to Your company decided that it would be the language of the future so you were forced to learn it At first you were excited to use Typescript You knew that it had a lot of potentials and would help you make more robust apps But after using it for a while You started to realize how annoying and frustrating it can be In this article I am going to vent my frustrations with Typescript I had just started using it like one month in and was struggling to get the hang of it After using it for a while I ve realized that it s so bad and there are things I don t like about it at all But before going over its drawback let s start with a gentle high overview of the language Table Of Contents TOC What is Typescript Why Do We Have TypeScript Should I use It Issues With Typescript The Learning Curve Strict Type Checking System Verbosity And Lack of Readability Lack Of Intuitive Syntax Lack of Compatibility Low Productivity False Promises Lack of Flexibility Giant Corporation Abuse Clever Devs Abuse Not A JS Superset Slower Compile Time Additional Transpilation Step Lack of Performance Writing Unit Tests Types Are Not That Useful Heavier Tech Debt TypeScript Alternatives JSDoc Flow Which One Should You Choose What s next for Javascript Conclusion References What is Typescript TypeScript Logo Developed and maintained by Microsoft TypeScript also known as JavaScript that scales is an object oriented open source programming language It s arguably considered a superset of JavaScript which I m afraid I disagree with containing additional typing Here is a simple snippet of code that demonstrates the difference between JavaScript and TypeScript JavaScriptvar name World console log Hello name TypeScriptvar name string World Or simply var name World console log Hello name And you guessed it right There s no difference at all So TypeScript is a statically not strongly a compiled programming language for writing clear and concise JavaScript code It fulfills the same purpose as JavaScript and can be used for client and server side applications In addition a codebase written in JavaScript is also compatible with TypeScript which is a good thing to have However Typescript promises to make web development easier and safer than ever through its typing system Unfortunately it doesn t live up to its promises Typescript is a difficult language to learn and often comes with an annoying learning curve Even experienced developers find themselves struggling with this language Why Do We Have TypeScript Image by Gordon Johnson from Pixabay Go To TOC You might be thinking Why would I want to do that I can use JavaScript instead The reason is that by typing your variables you can catch errors at compile time instead of runtime For example if you try to add a string and a number and store the result as a number you ll get a type error var x number var y string var z number x y output Type string is not assignable to type number ts However if you were to try this in JavaScript the code would run without any errors var x var y var z x y output As you can see types can help you catch errors early on in the development process By adding optional static types TypeScript allows us to be more explicit about the code they are writing and identify potential issues quickly This makes it easier for teams to collaborate and reduce time spent debugging code However there are still some situations where it falls short For instance consider the following example function push arr Array lt string number gt arr push let foo Array lt string gt foo push foo Even though we are pushing a number onto an array of strings TypeScript doesn t recognize the type mismatch and type checks the code successfully This is problematic because it is not immediately obvious that there s a type mismatch which can lead to runtime errors Despite my reservations about object oriented programming TypeScript might be an incredibly useful tool for OOP fans who need strong object typing Using the TypeScript compiler we can generate code with all the features and benefits of object oriented programming While JavaScript does not support strongly typed object oriented programming principles TypeScript does But this doesn t mean you should consider TypeScript for all your projects As stated in their docs not many companies are the size of Microsoft If you re working on a large scale JavaScript project TypeScript may be a good option However if you re starting with programming or working on a small project you may be better off sticking with the usual plain good old JavaScript Should I use It Image by Dave M from Pixabay Go To TOC Now the question is Should you use TypeScript for your next project And the answer lies in its features As I stated previously TypeScript provides optional static typing classes and interfaces which can help you develop large scale applications more effectively I would argue that working with TypeScript on a medium large sized project with multiple developers might be better but sometimes it is not actually the case The benefits of using TypeScript include the following Static Typing This is a pretty straightforward one It means you can catch errors at compile time before your code even runs This makes code more predictable and easier to debug But as we saw previously it is not always the caseType Inference TypeScript can often infer the types of variables which means you don t have to declare them explicitly This can make your code more concise and easier to read However this also can be achieved with JavaScript and JSDoc IntelliSense This is a feature of Visual Studio Code that provides autocomplete suggestions based on the types of variables This can again make your code easier to write and less error prone However IntelliSense is not tidily coupled to TypeScript but is also supported in JavaScript Shortly put we had a more specific better documented and more bulletproof code of higher quality However after using it for a while you may find that it makes your code less readable among many issues that we will go over in the next sections As such you should carefully consider whether or not TypeScript is right for your project before using it Issues With Typescript Most Disliked Aspects of TypeScript by State of JS In the following sections we will explore a list of the things I started ditching Typescript more than ever While Typescript is a powerful tool it also has some major drawbacks that have led me to go back to JavaScript more frequently The Learning Curve A steep learning curve Image by author Go To TOC Typescript can be difficult and time consuming to learn You must become proficient in JavaScript and type systems to use Typescript effectively This means you must invest time in understanding the intricacies of type systems and how you interact with JavaScript code Even experienced developers can find this difficult to grasp making it a huge barrier to entry for any new development project In addition Typescript has some idiosyncrasies that can be difficult to work around For experienced developers there is still no denying that learning Typescript can be a time consuming process Teams must invest heavily in training to ensure that everyone is up to date on the most recent changes and best practices This can also create a challenge when understanding existing code bases that utilize Typescript as its primary language In short the learning curve associated with Typescript can be quite steep and require significant time and effort to master Strict Type Checking System Go To TOC Another issue is that Typescript s type checking system can often be overly strict and difficult to work with This stringent approach can lead to extra work and debugging time when dealing with complex types or features that don t fit into the type system cleanly This extra effort can add up quickly over time and ultimately slow down development cycles The following example of a type only bubble sort using an arithmetic utility type is overly strict and difficult to work with Although the comparator type is clever it abstracts away a couple of the conditionals making it hard to debug and maintain This type of code is particularly difficult for beginners to grasp as it requires a deep understanding of types and their behavior type Test BubbleSort lt gt type Test BubbleSort lt gt type Test BubbleSort lt gt BUBBLE SORT type BubbleSort lt N extends number gt BubbleSortPass lt N gt extends Is lt infer OnePass number gt BubbleSortPass lt OnePass gt extends BubbleSortPass lt N gt BubbleSortPass lt N gt BubbleSort lt OnePass gt nevertype BubbleSortPass lt N extends number gt N extends Is lt infer First number gt Is lt infer Second number gt infer Rest Rest extends number Rest extends LessThan lt First Second gt extends true First Second Second First LessThan lt First Second gt extends true First BubbleSortPass lt Second Rest gt Second BubbleSortPass lt First Rest gt never never UTILITY TYPES type LessThan lt A extends number B extends number gt IsPositive lt A gt extends true IsPositive lt B gt extends true A extends B extends false true B extends false LessThan lt Subtract lt A gt Subtract lt B gt gt false IsPositive lt B gt extends true true A extends infer PosAStr B extends infer PosBStr StringToNumber lt PosAStr gt extends Is lt infer PositiveA number gt StringToNumber lt PosBStr gt extends Is lt infer PositiveB number gt LessThan lt PositiveB PositiveA gt never never never nevertype Is lt T extends U U gt T type Add lt A extends number B extends number gt StrictTupleLength lt TupleOfLength lt A gt TupleOfLength lt B gt gt type Subtract lt A extends number B extends number gt TupleOfLength lt A gt extends TupleOfLength lt B gt infer Result Result length never type IsPositive lt N extends number gt N extends number false true type StringToNumber lt T extends string A extends any gt T extends keyof A A length StringToNumber lt T A gt Types the utilities rely ontype StrictTupleLength lt T gt T extends length Is lt infer L number gt L nevertype TupleOfLength lt T L extends number R extends T gt R length extends L R TupleOfLength lt T L R T gt Verbosity And Lack Of Readability Go To TOC As I started my journey with Typescript I first noticed how verbose the language was It requires a lot of extra typing compared to JavaScript This can be attributed to the rigid syntax and the numerous rules one must remember This can be quite frustrating for those who are used to writing code quickly and efficiently in other languages The verbosity of Typescript can be quite a hindrance when trying to learn the language and debug code This is because it can be difficult to keep track of all the different elements in your code The language supposed to bring readability and clarity to the codebase obscures it instead The code below is an example of documented TypeScript which is incredibly bloated This makes the code difficult to read and understand which is one of the main arguments against using TypeScript class Rectangle width number string length number string Create a Rectangle instance param number width The width of the rectangle param number length The length of the rectangle constructor width number string length number string this width width this length length Calculate the area of a rectangle returns number The area of a rectangle example Correct usage Returns calcArea calcArea number var width Number this width var length Number this length return width length You d have to add so many type annotations along with your code Seriously just use JavaScript It s faster and simpler and you don t have to worry about all that type of stuff as they are presented through JSDoc class Rectangle width length Create a Rectangle instance param number width The width of the rectangle param number length The length of the rectangle constructor width length this width width this length length Calculate the area of a rectangle returns number The area of a rectangle example Correct usage Returns calcArea calcArea var width Number this width var length Number this length return width length Image by author This example shows you why you should not use TypeScript If you consider looking at the official core TypeScript codebase you will notice an excessive amount of unnecessary type annotations used throughout the codebase This shows that you should avoid using TypeScript whenever possible and rather stick to Javascript with JSDoc Lack Of Intuitive Syntax Go To TOC Typescript syntax can be difficult to understand especially for those new to programming The language uses conventions unfamiliar to developers coming from other languages and can make it difficult to read and understand the code Even after you feel comfortable with the language s syntax errors can still be difficult to decipher for beginners This is because Typescript has very strict rules and conventions so even if something looks valid it may not be accepted by the compiler For example Typescript requires that variables are declared with a type and that each parameter in a function must have a type assigned If these requirements are not met you will receive an error message that can be confusing for those new to programming The only way to overcome these hurdles as a beginner is to be patient and stick with it Don t get me wrong Typescript is still a powerful language that will allow you to write cleaner more efficient code but it will take time to get used to the syntax and conventions Lack of Compatibility Go To TOC TypeScript may seem like a great tool but it does not always play nicely with other tools For instance I recently wrote a Lambda function for a NodeJs environment The project manager wanted to be able to edit the function using the AWS online editor Unfortunately using TypeScript would have required transpilation making this impossible It was a deal breaker for the project manager so I had to revert to regular JavaScript So you will struggle using TypeScript when trying to integrate with existing technologies or frameworks Suppose you re working with a legacy system that doesn t support TypeScript In that case you ll find yourself in a tricky situation where you must manually convert your code into JavaScript before it works properly This can be time consuming and tedious especially if you don t know all of the nuances of both languages So don t assume that TypeScript will fit seamlessly into your existing workflow Do your research and ensure that it will actually work with the tools you re using or you risk wasting valuable time and resources Low Productivity Image from istockphoto com Go To TOC Typescript can be slow and cumbersome especially compared to more streamlined languages like JavaScript or Python This can be extremely frustrating for other developers who are used to working quickly and efficiently in other languages and me When you are trying to rapidly prototype something during a Hackathon the last thing you want is to deal with the extra overhead of Typescript This can often lead to frustration and wasted time as you try to work around the limitations of the language Over time Typescript can be quite frustrating especially compared to other more rapid development languages If you are looking to build something quickly you would be better off using ower beloved language Javascript However the question now is what about the bugs in production Typescript catches type bugs that would otherwise end up in production But why is it common among Devs who are overconfident in their ability to write bug free code False Promises Go To TOC Also I m not too fond of TypeScript because it s a language that tries to sell you the idea of solving all JavaScript problems It s trying to take over Javascript as the go to language for web development I like Javascript just the way it is and I don t want TypeScript to come in and try to change everything Even under the assumption that the lack of typing in JS is a problem TS does not solve it Do you know who does Java C C and other compiled languages They can safely guarantee strong typing at compile time and runtime Interpreted languages are just not capable of it A while back Deno a javascript runtime built on the V engine Rust and Tokio shared its own experience with Typescript which turned out to be a major hindrance to productivity and added unnecessary complexity to the system In their document they shared an example that entails that this is difficult to have visibility into because of the complexity of generating the runtime code This is in stark contrast to what the language promises it will help them organize their code While this may be true in some cases it seems that it can have the opposite effect in other cases Lack of Flexibility Go To TOC Typescript is a language that was created with the intention of making JavaScript more accessible which is why it has become so popular in recent years Unfortunately due to its design TypeScript puts a lot of restrictions on what you can do with the language It attempts to limit what you can do with JavaScript and obscure its strong sides while providing a false sense of security This can be extremely detrimental to developers as they cannot explore the true power of JavaScript or use it in ways they want or need to Developers need to understand that this lack of flexibility does not make them better developers indeed it may even hinder their development process and lead them away from truly understanding how JavaScript works and how to use it effectively Having limited capabilities can potentially lead to the inability to utilize the full potential of JavaScript If you want to become a great developer you need to understand the true power behind JavaScript and all its features rather than settle for a comforting lie from Typescript If you re serious about becoming a great developer you should not settle for a language that limits your creativity and hides the true power of the language Instead you should learn JavaScript and embrace its flexibility Only then will you be able to truly unlock your potential as a developer Giant Corporation Abuse Go To TOC Typescript is backed by Microsoft one of the biggest companies in the world This means they have a vested interest in pushing their own agenda and getting developers to use their technology This can be seen in the way they are marketing Typescript as the best language for developing with JavaScript However this type of marketing has been criticized by many developers who believe it is misleading and forcing people to choose their product Furthermore this type of big business backing can create an environment where developers feel pressured to conform and use the technology presented by Microsoft This can stifle creativity and lead to a one size fits all mentality regarding coding solutions The goal should be for developers to be able to choose from a variety of options that best suit their needs not be forced into using something that a corporate giant pushes Microsoft s strategy also creates confusion among developers who may not understand all the aspects of Typescript or why it would be better than other languages like JavaScript Companies like Microsoft need to ensure they provide accurate information about their product so that developers don t get confused or misled about what will work best for them If you don t know yet Microsoft has a long history of being an anti open source and anti Linux In their CEO Steve Ballmer declared Linux a cancer The company sponsored SCO s copyright attack on Linux and claimed that Linux violated unnamed Microsoft patents Microsoft also forced Linux based Android vendors to pay for dubious patent claims One of Microsoft s biggest issues today is its involvement with Typescript While the company has been trying to make strides in recent years to improve its relationship with the open source community its history still casts a long shadow So even though Typescript is a powerful programming language it s important to note that a historically bad corporation backs it Clever Devs Abuse Go To TOC The issue with clever developers using Typescript is that they unnecessarily over complicate the code This leads to several problems making code difficult to read maintain and debug Additionally it can cause issues with scalability and performance When clever developers use Typescript they often focus on writing clever and complex code rather than efficient and effective This can lead to a lot of wasted time debugging and trying to find solutions for problems that could have been avoided in the first place Furthermore clever developers may prioritize their own pride over the product itself They may be too focused on creating complex solutions when simpler ones are available This can lead to solutions that don t actually make the product better for users or customers Developers need to remember that the primary goal should always be customer satisfaction If a solution isn t making the product better or easier for users it isn t worth wasting time on it Clever developers should focus on creating solutions that improve customer experience instead of just attempting to make themselves feel proud of their code Let s all agree that just because clever developers use something doesn t mean it s a good tool But if so many big open source projects have moved to TS and told me that it made their development easier I ll trust them especially because it made mine much easier and less stressful Not A JS Superset Go To TOC One of the key selling points of Typescript is that it is a superset of javascript meaning that every JavaScript program is a valid TypeScript program However in practice this has not always been the case And TypeScript is neither a subset nor a superset of JavaScript For example a valid piece of JavaScript code may not be valid TypeScript code such as the following var foo foo bar Image by author Slower Compile Time Image by author Go To TOC One of the primary issues with using Typescript is the slower compile time This can be especially noticeable when working on a large codebase that needs to be compiled The TypeScript compiler is not as efficient at optimizing code as other compilers meaning that it takes longer to complete a compile task This can lead to larger file sizes and a longer time waiting on the compiler to finish its job The main reason for this slower compile time is due to the statically typed nature of Typescript This means that the compiler has to do more work than a compiler for a dynamically typed language like JavaScript which can lead to longer compilation periods Additionally the TypeScript compiler does not have access to the same optimization tools that Babel does further increasing compile time Consequently this will affect our productivity too Typescript code can be painfully slow to compile especially when you re working on larger projects In their document The maintainers of Deno noticed an incremental compile time when changing files in cli js take minutes This is crushingly slow and painful to modify As someone who s just started using the language I can attest to how frustrating this can be You make a small change wait a minute or two for the compiler to finish and then repeat It s a huge time sink and it quickly becomes frustrating I understand that some people prefer the type safety that TypeScript offers but in my opinion it s not worth the tradeoff in terms of productivity Additionally it can be achieved with JSDoc and some VSCode settings Additional Transpilation Step Go To TOC This issue is somewhat related to the previous one As a JavaScript developer you re probably used to transpiling your code with Babel TypeScript introduces an additional transpilation step which can unfortunately introduce a bottleneck regarding development speed It s true that the compiler can spot flaws and flag them before they can cause any damage but this comes at the cost of having to wait for the entire codebase to be transpiled each time This can be particularly frustrating for larger projects where the compilation time can quickly add up In addition the TypeScript compiler can sometimes generate code that may be confusing or difficult to read This is because it attempts to add type safety to your code which can sometimes result in longer or more complicated variable names While this is not always a bad thing it can make your code more difficult to understand particularly for newer developers who are not yet familiar with TypeScript s conventions Lack of Performance Go To TOC If you re writing code in TypeScript you might find that your code is running slower than expected That s because the TypeScript organization structure imposes a runtime performance penalty When you use TypeScript you re essentially telling the compiler to organize your code in a specific way And this organization can create problems when it comes to runtime performance For example if you have a large array of objects TypeScript will likely create a new variable for each object in the array This means that each time you access one of these objects you must look up its variable in memory This can be a huge overhead at runtime and can cause your app to perform poorly Writing Unit Tests Go To TOC When writing unit tests in TypeScript I often find myself frustrated by the need for precision With JavaScript I could simply pass an object with the necessary properties to a test but with TypeScript I am required to define the type of the object and all its properties This can be incredibly time consuming especially for those just starting out As a result I would much prefer to use JavaScript when writing unit tests The extra time spent defining types and properties detracts from the overall efficiency of my work Not only that it makes debugging and refactoring much more difficult as well For example if I need to change a single property of an object used in a test I would have to go back and modify the type definition and the test code itself This additional step wouldn t be necessary if I were writing my tests in JavaScript I understand why TypeScript requires this level of precision It helps add an extra layer of safety during development but it can sometimes be incredibly tedious and frustrating For this reason alone I will continue to choose JavaScript over TypeScript when writing unit tests Types Are Not That Useful Go To TOC If you come from a statically typed language like Java you might think that types are always good However in JavaScript types can actually be more of a hindrance than a help For one thing JavaScript is a very dynamic language which means that types can often get in the way of flexibility For another thing the type system in TypeScript is actually not that great Additionally TypeScript s type system isn t really necessary for most JavaScript applications Most applications don t need the extra safety and flexibility that types provide so using TypeScript adds complexity without providing any real benefit Therefore it s often better to stick with plain JavaScript when developing an application TypeScript also supports type inference when the compiler tries to guess the type of a variable based on how it is used This is not always reliable if the compiler can t figure out the type it will default to any That means that all type checking is effectively turned off for that variable That defeats the purpose of using TypeScript in the first place var a string var b number let c a Hello World b c a b console log c Image by author Heavier Tech Debt Image from istockphoto com Go To TOC When it comes to tech debt Typescript can be a major issue when a project s scope tech stack or architecture changes halfway through the process The tech debt will increase as new features and changes are added to the codebase This can cause projects to become bogged down with tech debt that could have been avoided if an earlier assessment of the project scope and design plan had been conducted For example suppose you decide to use Typescript for your project You may think this language will be easier to maintain in the long run as it is more type safe than other languages However halfway through the project you realize that a different technology stack would be better suited for your particular project You now have to go back and refactor all of your existing code from Typescript into the new technology stack which can take considerably longer than if you had chosen the correct language from the beginning As a result you find yourself weighed down by tech debt that could have been easily avoided with proper planning at the start of your project However you may argue that TypeScript is especially powerful when used in conjunction with other technologies For example Python and Go are two of the most commonly used general purpose programming languages while Bash is often used for smaller glue scripts GNU Make is often misused as a project entry point make run make build etc I wouldn t say no to TypeScript as this would force the always overworked operations team to write more quality code instead of fast hacks But at some point this accumulated debt will reach critical mass and it will be a long downtime just to write more fast hacks to get back up Therefore it is important to assess your project scope and design plan thoroughly before deciding on which language to use to ensure that you do not end up with unnecessary tech debt further down the line For all the above reasons type only code is needlessly complicated to work with TypeScript Alternatives Image by author Go To TOC Ok so here s the deal TypeScript is a great tool but it s not the only one out there JSDoc is another tool that can be used to annotate your code And it turns out that Microsoft is also using JSDoc for their core TypeScript code So why are we arguing about which tool to use Let s just use whatever works best for us But what if you want to avoid using TypeScript Or what if you want to use JSDoc without using the compiler There are several options for type checking and generating type definitions in JavaScript The two most popular options are JSDoc and Flow While Flow is more popular and has more features JSDoc is a valid alternative that can be just as effective JSDoc Go To TOC For those who don t know JSDoc is a JavaScript documentation tool that uses special comments to generate documentation for your code Here are a few reasons why you might choose to use JSDoc over TypeScript JSDoc eliminates the need for a compiler This makes it much easier and faster to write code and get up and running with your project Additionally JSDoc is often much more lightweight than their TypeScript counterparts allowing you to focus on the features and functionality of your code rather than worrying about type checking and other complex syntax issues JSDoc allows you to focus more on the quality and readability of your code Since you don t have to worry about type checking or maintaining complex types you can spend more time refining the details of your code and ensuring that it is properly documented Plus with JSDoc you can easily add annotations to your code which will help you understand what each section of code is meant to do This makes debugging and maintenance easier in the long run You can just write your tests in vanilla JS and rely on JSDoc to give you the types you need This makes it much easier to write tests for code that doesn t care about types but still needs to be reliable JSDocs are more flexible and allow for easy customization of test cases With TypeScript you are limited by its rigid type system but with JSDocs you can easily create custom test cases or tweak existing ones as needed This makes it very easy to tailor your tests for specific scenarios or edge cases that cannot be tested with TypeScript alone TypeScript requires annotations to generate documentation And you guessed it right This means that JSDocs are still necessary for TypeScript to generate documentation There is very little difference between the amount of typing required for vanilla JSDoc and TypeScript lightweight JSDoc One of the main reasons you might choose to use JSDoc over TypeScript is that it s natively supported by almost every IDE This means you don t have to install any additional dependencies to get JSDoc working Additionally JSDoc provides a more powerful way of documenting your code than simply using comments While TypeScript is a newer language and has gained quite a bit of popularity in recent years many developers me included still prefer to use JSDoc While it does not have all of the features of TypeScript of TS features in my opinion it is still a very useful tool for us as web developers JSDoc is well established and the standard for JavaScript documentation JSDoc is a widely accepted and adopted standard making it much easier to find libraries that use JSDocs as opposed to TypeScript def files If you have to compile TypeScript into JavaScript why not just use JS Seeing as the means for achieving what you require already subsist those familiar with JavaScript outnumber significantly those who know about TypeScript finding personnel is simpler and conjoining with existent teams is easier JSDoc adheres to the KISS principle by providing a simple yet powerful syntax that allows you to document your code briefly With JSDoc you can easily create documentation for your JavaScript code that s easy to read and understand As you can see JSDoc offers so many advantages for writing hints for the IDE and it would be wise for us as web developers to use it instead of TypeScript It provides granular control over code requires fewer steps when inserting a function name and offers an independent standard that ensures everything functions properly Microsoft is trying to create a narrative that the only way to fix the type issue is to switch over to TypeScript This however is not true It s clear that Microsoft s decision here is motivated completely by profit and not by what s best for developers or users of their products In summary using JSDoc instead of TypeScript may be beneficial for some projects where type safety isn t necessarily required or where time or resources are limited However if your project requires strong typing or complex logic then TypeScript may still be the better choice to ensure that your application meets its requirements Flow Go To TOC If you re not interested in using TypeScript Flow is also a great alternative Flow is a static type checker for JavaScript This means it can help you catch errors in your code before you even run it This is extremely powerful and can help you avoid many potential problems Like TypeScript Flow also allows you to define types for your variables and functions This can be extremely helpful in large projects where keeping track of types can be difficult Flow also has a few other features that TypeScript doesn t have such as support for React s propTypes The following are a few reasons why you might choose to use Flow over TypeScript Flow is faster Flow is the better option for faster compile times Not only does it fulfill its main purpose of checking for types but it can also offer faster compile times than its competitor TypeScript due to its ability to only check the files you have modified This contributes to the program s overall efficiency and makes Flow the superior option if you are looking to maximize efficiency and time Flow offers better error messages Have you ever been bogged down by error messages that are difficult to decipher and take ages to go through Flow could be your solution if you have ever struggled with this Flow offers better error messages than TypeScript does the messages are often shorter and simpler to comprehend Take a look for yourself and see how much more smoothly your coding journey can go with Flow Flow has a smaller footprint Flow is the simpler choice when it comes to integrating into projects That s because Flow requires no additional dependencies Unlike other type checkers Flow does not create any extra files such as d ts files This means that Flow has a much smaller environmental footprint and a much easier and simpler integration into any given project So if speed accuracy and simplicity are important to you Flow might be the right choice for your project Which One Should You Choose Go To TOC Now the question becomes which one should you choose It depends on your preferences and what you re trying to accomplish Flow is more popular and has more features but JSDoc is also a valid option Either way you ll get some level of type checking and generation for your JavaScript code so it s worth considering if you re working on a large project What s next for Javascript Go To TOC It seems like every day there s a new proposal to change javascript in some way And while some of these proposals are great there s one in particular that I think could ruin the language as we know it Static typing is something that has been proposed for javascript before but it never really gained much traction However with the recent popularity of languages like TypeScript and Flow it seems like more and more people are open to the idea of adding types to javascript Personally I m not a huge fan of static typing It can make code more verbose and difficult to read But more importantly it could make javascript less flexible and less forgiving Right now javascript is a language that is easy to learn and easy to use It s forgiving of mistakes and it s flexible enough to be used in a variety of ways But if we start adding types to the language all of that could change Javascript could become a lot more like Java with strict rules and regulations that must be followed And while that might be fine for some people I think it would ultimately make javascript less accessible for beginners So while I m not opposed to the idea of static typing in general I think it could be a disaster for javascript if it becomes mandatory Let s hope that doesn t happen Conclusion Go To TOC In conclusion being a humble developer I think TS is good but it s not always necessary or suitable for all projects You can achieve bugproof and readable code with JavaScript along with JSDoc with type definition plus a few config tweaks in VS without needing another compiler Ultimately though I think this depends on the team you work with and what sort of project you re dealing with if you need to do things quickly and work with junior developers then a codebase built on a strong foundation of TypeScript may be necessary to ensure quality Still other approaches may be more suitable if you have proper code reviews and knowledge sharing culture So why would anyone want to use TypeScript over javascript In my opinion javascript is a better language for writing code that is bug free readable and maintainable While TypeScript does offer some benefits I believe that the benefits of javascript outweigh the benefits of TypeScript In my honest opinion going from JavaScript to Typescript is like transitioning from PHP to C The core concepts remain the same However you are adding a layer of type safety and an additional compilation step At the end of the day it s totally up to you whether or not you choose to hate Typescript But if you re looking for a reliable way to write code that will keep your application functioning for years to come there s no denying that learning how to work with it is an invaluable skill So don t give up on it just yet keep coding and be humble about your own knowledge References Go To TOC Ryan Carniato The Trouble with TypeScript Ryan Carniato dev to Retrieved typescriptlang org Why Create TypeScript typescriptlang org Retrieved visualstudio com JavaScript IntelliSense visualstudio com Retrieved typescriptlang org Type only bubble sort in TypeScript typescriptlang org Retrieved theregister com Ballmer Linux is a cancer theregister com Retrieved stackoverflow com Typescript compiling very slowly stackoverflow com Retrieved docs google com Design Doc Use JavaScript instead of TypeScript for internal Deno Code docs google com Retrieved tc on Github ECMAScript proposal for type syntax that is erased Stage github com Retrieved |
2023-01-02 16:19:06 |
Apple |
AppleInsider - Frontpage News |
How to format flash drives for Mac and PC |
https://appleinsider.com/inside/macos-ventura/tips/how-to-format-flash-drives-for-mac-and-pc?utm_medium=rss
|
How to format flash drives for Mac and PCIf you have to use a flash drive on both Macs and Windows PCs make sure both systems can read it Here s how to format the drive correctly External flash drives can be very small While there is a lot of interoperability between Apple s Mac ecosystem and Windows computers not everything is completely rosy One of these areas is data sharing Read more |
2023-01-02 16:59:14 |
海外TECH |
Engadget |
Samsung's new wall oven lets you livestream a video feed of what's cooking |
https://www.engadget.com/samsung-bespoke-smartthings-wall-oven-hood-fridge-sustainability-164725174.html?src=rss
|
Samsung x s new wall oven lets you livestream a video feed of what x s cookingSamsung is refreshing its lineup of customizable Bespoke smart appliances with a wall oven washer and dryer The Bespoke AI Oven has a seven inch screen and touch controls The cooking methods include air sous vide air frying and steam cooking Perhaps the most intriguing element though is the AI Camera that s inside The camera can detect what you re making and suggest optimal cooking settings if it recognizes what you re making Samsung says Moreover it can send you warning notifications to prevent your food from burning You can keep an eye on your food using the screen or the SmartThings app which you can use to control the oven remotely There s the option to take photos of your creation or even livestream the video feed which could help budding Twitch creators find their niche nbsp In addition the oven has Samsung Health integration and can analyze workout stats and diet goals based on the ingredients you have on hand The Bespoke AI Oven is available in Europe now and will arrive in North America this summer Also new is the Bespoke Wall Mount Hood It s designed to match other Bespoke appliances and is said to operate at decibels on its highest setting The hood can ventilate up to cubic feet per minute Samsung claims The hood can sync with a smart Samsung cooktop to adjust the ventilation levels based on what you re cooking In addition there s an air quality sensor to track the cleanliness of the air If the device detects that the air quality has dropped you ll receive suggestions for how to remedy that via the SmartThings app You ll be alerted when it s time to replace the air filter too As with the wall oven the hood will be available in a variety of colors and premium finishes SamsungAs for the company s fridges the Door Flex now has a larger Family Hub touchscreen It now measures inches so the screen is almost percent larger than on previous models Samsung says that you ll be able to more easily use multiple apps at once and to multitask The display includes a built in SmartThings Hub as well This will help you to connect other SmartThings compatible devices without the need for other hub hardware nbsp As with previous models there s an AI powered camera inside that can analyze food labels and images to help make sure you don t run out of the essentials The latest Door Flex will be available in North America and Korea in the first half of the year Meanwhile the new Bespoke Side By Side fridge has touch sensors on each door so you can open them when your hands are full Like the Door Flex it has SmartThings integration and the built in Beverage Center with two options each for filtered water and ice This model will be available in the US by the end of March SamsungFinally Samsung had some updates on the sustainability front This year the company will release microfiber emission reduction cycles and filters for its Bespoke washing machines The aim is to reduce microplastic pollution in water The company also says that it has received the industry s first Energy Star Smart Home Energy Management Systems Certification for its SmartThings Energy system Samsung claims the AI Energy Mode it recently started rolling out can reduce its appliances power consumption by up to percent without significantly impacting performance For instance it might make your freezer one degree warmer or reduce the maximum water temperature on your dishwasher |
2023-01-02 16:47:25 |
海外TECH |
Engadget |
The best smart scales for 2023 |
https://www.engadget.com/best-smart-scale-160033523.html?src=rss
|
The best smart scales for Data is a useful tool in any battle especially if you re opting to wage war against your waistline in an attempt to be healthier Back in I bought a dirt cheap scale and drew my own graph sheets in order to chart my weight s downward progress after a rough year at university I think that while me wouldn t be pleased with my own fitness journey he would love the fact that the process is entirely automated and affordable Consequently allow me to take you and him on a journey to pick the best smart scale to help you on your own journey toward behavior change SafetyThere are valid reasons to weigh yourself but your self worth shouldn t be defined by the number that shows up between your feet If you re looking to alter your body shape that figure could go up as your waistline goes down since muscle weighs more than fat Dr Anne Swift Director of public health teaching at the University of Cambridge said that “weighing yourself too often can result in you becoming fixated on small fluctuations day to day rather than the overall trend over time Swift added that “it s sometimes better to focus on how clothes fit or how you feel rather than your weight A meta analysis from found there may be some negative psychological impact from self weighing A study however said that there may be a positive correlation between regular weigh ins and accelerated weight loss It can be a minefield and I d urge you to take real care of yourself and remember that success won t happen overnight What to look for in a smart scaleWeightA weighing scale that weighs you is probably the top requirement right One thing to bear in mind is that with all these measurements the figures won t be as accurate as a calibrated clinical scale Consequently it s better to focus on the overall trend up or down over time rather than the figures in isolation ConnectivityMost scales will either connect to your phone over Bluetooth or to your home s WiFi network and you should work out your regular weighing routine ahead of time A lot of lower end Bluetooth only models will only record your weight when your phone is present and don t keep local records That means if you routinely leave your phone outside the bathroom you could lose that day s stats WiFi connected scales on the other hand post your stats to a server letting you access them from any compatible device But you need to be mindful that there s a small risk to your privacy should that information be compromised Bone densityThe stronger your bones the less you re at risk from breaks and osteoporosis which you should keep in mind as you get older Clinical bone density tests use low power x rays but higher end scales can offer an approximation from your own bathroom These tests pass a small current through your feet measuring the resistance as it completes its journey The resistance offered by bones fat and muscle are all different and your scale can identify the difference Body fat percentage and muscle massFat and muscle are necessary parts of our makeup but an excessive amount of either can be problematic Much like bone density a scale can identify both your body fat and muscle mass percentages using Bioelectrical Impedance Analysis BIA This measurement tests how well your body resists the electrical signal passing through your body It s a rough rule of thumb that you should have a percent split between fat and muscle but please consult a medical professional for figures specific to your own body and medical needs BMIA lot of scales offer a BMI calculation and it s easy to do since you just plot height and weight on a set graph line Body Mass Index is however a problematic measurement that its critics say is both overly simplistic and often greatly misleading Unfortunately it s also one of the most common clinical metrics and medical professionals will use it to make judgements about your care Pulse Wave VelocityFrench health tech company Withings has offered Pulse Wave Velocity PWV on its flagship scale for some time although regulatory concerns meant it was withdrawn for a period of time It s a measurement of arterial stiffness which acts as a marker both of cardiovascular risk and also other health conditions I ve had anecdotal reports that PWV scales have sent people to the doctor where they ve found they were close to a cardiac event It s worth saying as with all of these technologies that there is limited albeit positive research into how accurate these systems are DisplayLess a specification and more a note that smart scales have displays ranging from pre printed LCDs or digital dot matrix layouts through to color screens On the high end your scale can show you trending charts for your weight and other vital statistics and can even tell you the day s weather If you are short sighted and plan on weighing yourself first thing in the morning before you ve found your glasses contacts opt for a big clear high contrast display App and subscriptionsYou ll spend most of your time looking at your health data through its companion app and it s vital you get a good one This includes a clear clean layout with powerful tools to visualize your progress and analyze your data to look for places you can improve Given that you often don t need to buy anything before trying the app it s worth testing one or two to see if you vibe with it Several companies also offer premium subscriptions unlocking other features including insights and coaching to go along with your hardware Fitbit and Withings both offer these services which you may feel is worth the extra investment each month Data portabilityUsing the same scale or app platform for years at a time means you ll build up a massive trove of personal data And it is or should be your right to take that data to another provider when you choose to move platforms in the future Data portability is however a minefield with different platforms offering wildly different options making it easy or hard to go elsewhere All of the devices in this round up will allow you to export your data to a CSV file which you can then do with as you wish Importing this information is trickier with Withings and Garmin allowing it and Omron Xiaomi Eufy and Fitbit not making it that easy Apps that engage with Apple Health meanwhile can output all of your health data in a XML file PowerIt s not a huge issue but one worth bearing in mind that each scale will either run disposable batteries most commonly xAAA or with its own built in battery pack Sadly all of our crop of smart scales use batteries adding an environmental and financial cost to your scale life That s just about forgivable for scales that cost under but this stretches even to the highest end models When you re spending more than that on a device the lack of a rechargeable cell feels very very cheap indeed The smart scales we testedFor this guide I tested six scales from major manufacturers Mi Xiaomi Body Composition Scale XiaomiOur cheapest model Xiaomi Mi s Body Composition Scale is as bare bones as you can get and it shows It often takes a long while to lock on to get your weight and when it does you ll have to delve into the Zepp Life branded app in order to look at your extra data But you can t fault it for the basics offering limited weight and body composition for less than the price of a McDonald s for four Fitbit Aira Air FitbitFitbit now part of Google is the household name for fitness gear in the US right If not then it must be at least halfway synonymous with it The Aria Air is the company s stripped to the bare bones scale offering your weight and little else but you can trust that Fitbit got the basics right Not to mention that most of the reason for buying a Fitbit product is to leverage its app anyway Anker Eufy Smart Scale P Pro Eufy AnkerEufy s Smart Scale P Pro has plenty of things to commend it the price the overall look and feel it s a snazzy piece of kit and what it offers It offers a whole host of measurements including Body Fat Muscle Mass Water Body Fat Mass and Bone Mass as well as calculating things like your Basal Metabolic Rate the amount of calories you need to eat a day to not change weight at all all from inside its app In fact buried beneath the friendly graphic the scale offers a big pile of stats and data that should I think give you more than a little coaching on how to improve your lifestyle Shortly before publication Anker Eufy s parent company was identified as having misled users and the media about the security of its products Its Eufy branded security cameras which the company says does not broadcast video outside of your local network was found to be allowing third parties to access streams online Consequently while we have praised the Eufy scale for its own features we cannot recommend it without a big caveat nbsp Omron BCM Body Composition and Scale with Bluetooth OmronGiven its role in making actual medical devices you know what you re getting with an Omron product A solid reliable sturdy strong checks the dictionary for more synonyms dependable piece of kit There s no romance or excitement on show but you can trust that however joyless it may be it ll do the job in question The hardware is limited the app is limited but it certainly checks synonyms again is steady Joking aside Omron s Connect app is as bare bones as you can get since it acts as an interface for so many of its products Scroll over to the Weight page and you ll get your weight and BMI reading and if you ve set a goal you can see how far you ve got to go to reach it You can also switch to seeing a trend graph which again offers the most basic visualization on offer Garmin Index S GarminGarmin s got a pretty massive fitness ecosystem of its own so if you re already part of that world its scale is a no brainer On one hand the scale is one of easiest to use and most luxurious of the bunch with its color screen and sleek design I m also a big fan of the wealth of data the scale throws at you you can see a full color graph charting your weight progress and the various metrics it tracks in good detail If there s a downside it s that Garmin s setup won t hold your hand since it s for serious fitness people not newbies Withings Body Comp WithingsAt the highest end Withings flagship Body Comp is luxurious and luxuriously priced a figure I d consider to be “too much to spend on a bathroom scale For your money however you ll get a fairly comprehensive rundown of your weight body fat vascular age pulse wave velocity and electrodermal activity Its monochrome dot matrix display may not be as swish as the Garmin s but it refreshes pretty quickly and feels very in keeping with the hardware s overall sleek look If there s a downside it s that Withings ditched the rechargeable battery found in the Body Cardio its former flagship and an excellent scale I d recommend if it were within the parameters of this guide in favor of AAA batteries Which when you re spending this much on a scale makes me feel very nickel and dimed The best cheap smart scale Fitbit Aria Air Mi Body Composition Scale It s very competitive at the low end and Xiaomi and Fitbit offer dramatically contrasting products for a very low price Fitbit s scale has far fewer features but has better build quality is faster and more reliable than its cheaper rival Crucially it also leverages Fitbit s own app which is a long refined and easy to use app that offers clean easy to understand visualizations Xiaomi meanwhile offers weight and some basic body composition checks although this extra data is only visualized inside the app From a data perspective the Xiaomi has the edge but its companion app formerly Mi Fit now branded as Zepp Life is terrible The lag time for each weigh in too leaves a lot to be desired with the Xiaomi although I had no qualms about its accuracy When I was a kid and complained about something my nan would say “look you can either have a first class walk or a third class ride And Fitbit s scale here is the very definition of a first class ride polished snappy and with a world class app by its side The Xiaomi meanwhile offers more for your money and charges less but both hardware and software lack any sort of polish It s therefore up to you if you d rather the first class walk or the third class ride The best scale for people who want features and aren t fussed about security Eufy s P ProWell this is awkward Not long before this guide was published it was revealed that Eufy is in the midst of a massive security issue Researchers found that its security cameras which were promised to be secure allowed internet users to access the stream using VLC player Consequently the high praise for Eufy s P Pro I have as a scale will need to be moderated by the fact that we don t yet know how deep the company s promises around privacy and security really run It s unfortunate as the scale does leap head and shoulders above the competition at this level and it surpassed my expectations by quite a bit The ease of use was one thing but the depth of data made available in the app and the way it presents that information is fantastic While I don t think the Eufy Life app is better than say Withings class leading Health Mate it offers exactly what a would be weight watcher would need The fact you can get plenty of your vital statistics graphed by hitting two buttons helps you visualize your progress but the stat dashboard laying out everything including your BMR is so useful If you re going all Quantified Self you could theoretically calculate your daily calorie intake to the finest of fine margins looking at this thing every morning The best scale for athletes Garmin Index SI m very partial to Garmin s Index S but I also think it s the sort of scale that needs to be used by people who know what they re doing Almost everything about the hardware is spot on and the only fly in its ointment is the low refresh rate on its color screen I can t say how upsetting it was to see the display refresh in such a laggy unpolished manner especially when you re spending this much money But that s my only complaint and the rest of the hardware and software is otherwise pitch perfect If you re looking to alter your body shape this probably isn t the scale for you it s the scale you buy once you already calculate your BMR on a daily basis The best scale for the worried well Withings Body CompNaturally if you re looking for a machine that ll cater to your every whim and hypochondriac urge then Withings Body Comp is the way forward It s a luxury scale in every sense of the word and you should appreciate the level of polish and technology on show here Apart from the batteries which I ve already said is a cheap and nasty way to save money given that you re dropping this much money on a product The group of people who think it s reasonable to spend on a scale is especially with food and energy prices spiking a fairly small one But if you re the sort who already spends hand over fist to keep your body in check this is probably justifiable as an “investment Knowing all of the extras about your nerve health and arteries is a bonus but let s be clear and say this isn t the scale for everybody Hell you might have second thoughts even if you do have a subscription to Good Yachting Magazine |
2023-01-02 16:00:33 |
ニュース |
BBC News - Home |
Perth hotel fire: Three dead in blaze at New County Hotel |
https://www.bbc.co.uk/news/uk-scotland-tayside-central-64144080?at_medium=RSS&at_campaign=KARANGA
|
scottish |
2023-01-02 16:13:07 |
ニュース |
BBC News - Home |
Prince Harry: 'I want my father and brother back' |
https://www.bbc.co.uk/news/uk-64145773?at_medium=RSS&at_campaign=KARANGA
|
harry |
2023-01-02 16:53:46 |
ニュース |
BBC News - Home |
Ukraine claims hundreds of Russians killed by missile attack |
https://www.bbc.co.uk/news/world-europe-64142650?at_medium=RSS&at_campaign=KARANGA
|
moscow |
2023-01-02 16:23:31 |
ニュース |
BBC News - Home |
More MEPs could lose immunity in corruption probe, president says |
https://www.bbc.co.uk/news/world-europe-64146807?at_medium=RSS&at_campaign=KARANGA
|
corruption |
2023-01-02 16:12:51 |
ニュース |
BBC News - Home |
Pele's funeral: Brazil legend lying in state in Santos' stadium |
https://www.bbc.co.uk/sport/football/64145207?at_medium=RSS&at_campaign=KARANGA
|
santos |
2023-01-02 16:24:22 |
ニュース |
BBC News - Home |
Match of the Day 2 analysis: How Aston Villa dominated Tottenham Hotspur in midfield |
https://www.bbc.co.uk/sport/av/football/64147229?at_medium=RSS&at_campaign=KARANGA
|
Match of the Day analysis How Aston Villa dominated Tottenham Hotspur in midfieldMatch of the Day pundits Fara Williams and Matt Upson analyse Aston Villa s tactical choices and dominant midfield performance against Tottenham Hotspur in their win on New Year s Day |
2023-01-02 16:02:56 |
サブカルネタ |
ラーブロ |
煮干しつけ麺 宮元@蒲田 極濃魚介もりそば |
http://ra-blog.net/modules/rssc/single_feed.php?fid=206339
|
東京都大田区西蒲田 |
2023-01-02 16:14:02 |
北海道 |
北海道新聞 |
スキーの男性遭難か 札幌国際スキー場 |
https://www.hokkaido-np.co.jp/article/783115/
|
札幌国際スキー場 |
2023-01-03 01:18:00 |
コメント
コメントを投稿