Items tagged with: switched
Article word count: 1291
HN Discussion: https://news.ycombinator.com/item?id=19651245
Posted by philonoist (karma: 1375)
Post stats: Points: 94 - Comments: 97 - 2019-04-13T05:21:34Z
#HackerNews #code #from #jetbrains #studio #switched #visual #webstorm #why
As Visual Studio Code got more and more popular I used it for my further web projects. I really liked it because it was much faster, highly customizable and free so that I could also use it for my private projects.
In my current project, I met a developer who was really confused that I was using an editor and not an IDE for the development of large business applications. First, I did not really consider his concerns but meanwhile, I understand him.
In this blog post, I want to tell you why I now mainly use WebStorm instead of VS Code for development.
This is a very hot topic and I know this will cause some controversy. In the following article, I talk about my experience using WebStorm in a large Angular application which was mainly developed in VS Code.
WebStorm provides a robust, fast, and flexible static code analysis. This analysis detects language and runtime errors, suggests corrections and improvements. It also indexes your whole project and can, for example, detect all unused methods, variables and more.
VS Code VS Code Unused Angular Methods
WebStorm WebStorm Unused Angular Methods
This can have a huge impact on the code quality of a large Angular code base which was mainly developed using VS Code.
To see the difference open your project which was developed in VS Code with WebStorm and run the code inspection. This was basically what convinced me that using WebStorm results in a cleaner code base.
Integrated Karma Tests
WebStorm has an integrated test runner which I really like. This way you can run your tests directly from the IDE and even debug them there.
Running my jasmine & Karma tests in WebStorm I can easily jump to the failed test code and rerun only this specific test. The following image shows such a test run:
WebStorm Karma Tests
My Angular unit test workflow in VS Code is normally to mark a describe or it test block with a f (e.g. fdescribe) which tells Karma to only run this certain test block. Alternatively, I use the karma-jasmine-html-reporter where you can also define to run only certain tests by clicking on them in the HTML page.
There is currently also a VS Code Karma Test Adapter in development which should provide a similar integrated Karma test functionality for VS Code.
Not waiting for promises can be really tricky if you expect the subsequent code to run only after the promise has been resolved. WebStorm shows if there are unresolved promises (in this case for a TypeScript application):
WebStorm VS Code Unresolved Promise
VS Code has currently no possibility to show this information:
VS Code WebStorm Unresolved Promise
Source Control / Git Integration
VS Code has per default a pretty basic git integration. You can either use extensions like GitLens or use additional tools like Sourcetree if you like to use a GUI for complex git work.
WebStorm provides all the functionality for complex git work out of the box. You can commit files, review changes, and resolve conflicts with a visual diff/merge tool right in the IDE.
VS Code does not save a local history of your changes but you can use extensions like Local History.
WebStorm automatically tracks all the changes you made to your files and therefore protects you from accidentally losing these changes. You can inspect the history of files and directories and do rollbacks. This can be useful if you, for example, did a git push force by accident and overwrite your files even on the remote branch.
VS Code can only debug web application on Chrome by using the Debugger For Chrome extension which you then need to configure for your application.
Using WebStorm you already have everything available per-default and, for example, for Angular just need to click “Debug Application” and you can set breakpoints in the editor and watch variables etc.
In my opinion, refactoring code is much better using WebStorm. You can rename a component and it updates all file names and usages both in the HTML as well as in the TypeScript files. In general, all the JetBrains IDEs are well known for their refactoring features:
A well-known feature of the JetBrain IDEs is Safe Delete. Using this functionality you can safely remove files from your source code during refactoring. The IDE will first search for usages of the files and if they are found, you can check them and make necessary before the files are deleted.
Unfortunately, VS Code is not that powerful at the moment.
Angular CLI Integration
WebStorm provides a good Angular CLI integration by the so-called Angular Schematics:
WebStorm Angular Schematics
In total, WebStorm has great Angular support as it assists in editing Angular templates, provides code completion for variables, pipes, and template reference variables.
WebStorm is developed in Java and it feels in general slower than VS Code. I would not say that it is critically slower but the speed difference is noticeable.
VS Code has a faster startup time but if you are working on a project your IDE or editor is always open and startup time does not play a crucial role.
Accessibility Inspections For HTML
WebStorm provides inspections which are based on recommendations from Web Content Accessibility Guidelines (WCAG) which help you to write more accessible HTML code.
WebStorm HTML Accessibility Inspection
VS Code is open source and free to use.
You need to pay for a WebStorm license unless you choose one of the free licenses available for open source projects, students, teachers, classroom assistance or training courses, coding schools and boot camps.
Another option is to use the EAP (Early Access Program). These pre-release versions include features which will be added to the next release. These versions are temporarily available before a new version of the software will be released.
This is the official disclaimer for the EAP:
This is an early access version of the product. You expressly acknowledge that this version of the product may not be reliable, may not work as intended and may contain errors. Any use of the EAP product is at your own risk.
VS Code is more of an editor than an IDE like WebStorm is categorized as. WebStorm has in its standard installation more features than VS Code has in its default installation without any additionally installed extensions.
Microsoft has created an amazing product with VS Code which you can of course use for larger business applications. Generally, I would prefer and recommend using WebStorm due to these reasons:
* Better code analysis functionalities * All-in-one IDE with good basic functionality without the need to install many additional plugins * Much better code refactoring possibilities
If you prioritize speed, prefer using open source software or just want to quickly edit some configuration files then you should go for VS Code.
What are your experiences using VS Code and WebStorm? Let me know in the comments what you use to develop your application!
My VS Code & WebStorm Setup
The screenshots in this article show VS Code using the Material Dark Theme and WebStorm using the Material UI with Material Darker theme.
HackerNewsBot debug: Calculated post rank: 95 - Loop: 95 - Rank min: 80 - Author rank: 65
I spent some more time with Python and started to realize that I needed something more. Here's a brief list of the reasons why I switched to Clojure.
Article word count: 1081
HN Discussion: https://news.ycombinator.com/item?id=19477990
Posted by bsg75 (karma: 4902)
Post stats: Points: 123 - Comments: 86 - 2019-03-24T18:43:17Z
#HackerNews #2016 #clojure #from #python #switched #why
First – a bit of background. When I first started learning programming, I started with a course in high school that focused on Java. From there, I decided I wanted to work for a start-up and I had to learn python (I was naive). I started playing with Python and it just felt right – at first. I spent some more time with it and started to realize that I needed something more. Here’s a brief list of the reasons why I switched.
Python is a dynamic language. There’s a massive list of Pros and Cons for this, but I’ll highlight a few of my concerns.
* It’s easy to introduce bugs on uncommon code paths that would be much more obvious in a compiled language. * The performance of an interpreted language is almost always slower than a compiled language.
Those things aside, I LOVED being able to quickly run code with a fast turn around time. When testing, I didn’t have to worry about compiling anything and, when I was developing with Flask, tools like Live-Reload were things I didn’t want to give up.
With Clojure, I found that I could have the benefits of an Interpreted Language and the benefits of a compiled language, too! By leveraging Clojure’s REPL, I’m able to quickly test code before/while/after I write it. You’re able to switch into your Clojure codes namespace and test any functions you’ve written, as well as get the source code for any specific function, or check the docs for any function too! If you’re not using the REPL when you’re writing Clojure, you really should give it a try! If you’re using Leinengen, you can run lein repl from your project directory!
With Clojure, you compile down to Java Byte Code when you run your application or library. You get the benefits and performance optimizations of a compiled language, but can treat it like an interpreted language when developing. It’s great!
Classes Vs Data
When I moved from Java to Python, I fell in love with Mutable Dictionaries. I became very intimate with the dictionary API and defaulted to using them instead of classes because they often met my needs on their own and honestly, the “implied self parameter” on python methods turned me off. Dictionaries are basically just a map data structure.
When I learned about Clojure, I was baffled by their lack of classes, but felt liberated by the thought of only writing functions in namespaces. I decided to give it a try and immediately started thinking of Dictionaries in Python and how I didn’t enjoy writing classes. With Clojure, I’m able to focus on what the data looks like, and not on how an object is expected to act (What’s an instance of a class but a hash-map with some namespaced functions anyways?).
Immutable Data & Stateless Code
Like most now-functional programmers, I had THE incident. I had a class with several methods, but only two were particularly important. Both methods were getters, but the 1st method updated the value that was returned by the 2nd. This was extremely misleading when the code executed. In fact, almost all of the bugs with this code revolved around this theme. I didn’t know what to do and I thought this was the expected way to write code. I later read a great post on immutable data and tried writing my python code this way. This worked great – until I started working with other developers.
With Clojure, you have to fight to use mutable data structures (that’s not to say it’s impossible, it’s just not the default). More importantly, if you’re working with Clojure developers, chances are they’re very familiar with the benefits of immutable data. I say “fight” because you do have to put forth some effort to do it, but you often don’t really want to.
Don’t get me wrong, the Python community is great. Probably one of the best ones out there, actually. By comparison, Clojure’s community is very small. As you know, the communities are the groups of people responsible for building libraries for the language to use and helping people who get stuck with strange error messages or confusing domain problems. In terms of libraries, Clojure has extremely nice Java Interoperability (Clojure can call Java code directly from itself). This means that Clojure has access to ALL Java libraries and any clojure libraries as well. That’s a vast amount of libraries!
The support and documentation for most Clojure things pales in comparison to python, it’s true, but what I have noticed is that it matters where it counts. Clojure’s core API is relatively lean and extremely well documented. Additionally, the Clojure community didn’t experience the weird split that Pythonistas had with Python2 and Python3 (I’d imagine this is worked out by now, but I haven’t kept up with Python since I stopped writing it for anything more than scripts).
No __init__.py or __setup__.py
A shitty reason to dislike python, but these both irritated me a LOT.
For those who don’t know, and init.py file is used to declare a directory as a python module, while a setup.py is used to define how other scripts should interact with yours. That being said, neither of these have to do just that. In fact, I feel like the expectations for what each should do is extremely vague and troublesome. Some people prefer to import modules into their init.py or even add convenience functions there, too. It’s often easy to overlook these files, but if you can’t find the definition for a particular function or module, check the init.py
As for setup.py, you should probably just call the setup function from distutils.core. But, you can do more in that file – so much more! In fact, the actual documentation on this is pretty vague on what all should exist in a setup file, and can be found here.
To sum everything up, I switched predominantly because I wanted to speed and comfort of the JVM, but wanted a language that supported functional programming paradigms. Which do you prefer – Python or Clojure or something else? Comment below and let me know!
HackerNewsBot debug: Calculated post rank: 110 - Loop: 154 - Rank min: 100 - Author rank: 35