Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.

Sign Up

Articles related to "code"

Improving DataView performance in V8

  • CSA is a portable assembly language that allows us to write code directly in TurboFan’s machine-level intermediate representation (IR), and we use it to implement optimized parts of V8’s JavaScript standard library.
  • In order to make it easier for developers to contribute to the optimized JavaScript standard library in V8, and to improve readability and maintainability, we started designing a new language called V8 Torque, that compiles down to CSA.
  • Implementing TurboFan inlining finally allowed us to match, and even exceed, the performance of our Uint8Array wrapper, and be 8 times as fast as the former C++ implementation.
  • We found that our new DataView implementation provides almost the same performance as TypedArrays when accessing data aligned in the native endianness (little-endian on Intel processors), bridging much of the performance gap and making DataViews a practical choice in V8.

save | comments | report | share on

Is “data scientist” the new “programmer”?

  • Back in the 1970s, being a “programmer” meant writing one or files of code that input data, processed it in some way, and then output a result.
  • A program that occupied more than 256 KB of memory, even on a mainframe, would have been considered bloated (and wouldn’t have run at all on a “minicomputer,” at least not without a painful process of overlaying).
  • Thus, there tended to be a lot of interesting stuff going on within every few lines of code and certainly an entire file of code might contain nearly everything interesting about an application.
  • Is it more interesting to work in “data science” than “software engineering” or “programming”?
  • Older readers: Is today’s “data science” more like a programming job from the 1970s “scarce memory” days?
  • If their code is under version control and covered by automated tests then yes they are the new programmers.

save | comments | report | share on

Demystifying Webpack

  • Let's breakdown the concepts of webpack and understand what happens during the bundling process.
  • A bundler is a utility/program that takes a number of files and puts them together in such a way it doesn't change how the code works.
  • And I defined A.js as my entry point for webpack and the output to be a single bundled file.
  • The first thing webpack will do is analyze the modules that are present and form a dependency graph.
  • Likewise it keeps adding content of the modules to the output file till it has finished traversing the dependency graph.
  • While webpack is creating the graph it also marks whether the module is used or not.
  • The code is quite simple to understand it takes in a moduleId and checks whether that module is present in installedModules cache.

save | comments | report | share on

10 practices for readable code

  • Over the last several months I've worked to distill these elements into 10 practices for writing code with a focus on improving readability and decreasing complexity.
  • All those commented blocks, unused variables, and unreachable code are rot.
  • Nested code can often be removed by guard clauses, early returns, or aspects of functional programming.
  • While I don't adhere to hard numbers, code blocks do reach a critical length.
  • This simple process allows you to determine the context and abstraction level of the code block so you can properly refactor the code into a more readable and less complex block.
  • Now I provide another number in the series 2, 4, 16 and ask, "What's next?" Now with three data points our programmer brains see the squared series and determine the next number to be 256.
  • This touches naming, formatting, architecture, block size, basically anything that contributes to code appearance.

save | comments | report | share on

Refactoring Legacy Monoliths - Part 3: Game Plan And Refactoring Tips

  • Having tests in place is like doing acrobatics in the air with a safety net vs.
  • Your first goal should be to start implementing unit tests on your code.
  • You need to be able to change your code and have confidence that it still works.
  • Your first goal should be to implement code-based testing.
  • LinkGenerator needs access to "Thing 3", which is, the HttpSession.
  • We can't test this method because it references the HttpSession object that only exists in a web application.
  • We don't want our models or business entities to know about the web (this is in line with our goal of isolating business entities from the presentation of our data).
  • Take a chunk of code that does one thing, and create a new method out of it.
  • Avoid references to global state (like HttpSession) so that you can unit test your new methods.

save | comments | report | share on

Golang, it was love at first sight.

  • Usually, when people have free time they do some R&R, but me, being weird and all I like to learn, experiment and play with new things.
  • Reading about new architectural styles, scalability & cloud I found a pattern, most of the big companies (www backbone) switched in a way or another to Go. When reading about it I found that we had a lot in common (me & Go), it’s a good start for any relationship.
  • If {you are a Gopher please help me learn faster and review my code:} bgadrian/data-structures *data-structures - Abstract data structures Go packages, built with performance and concurrency in mind to learn Go. It is the perfect mix between low & high-level languages.

save | comments | report | share on

Ubtech launches Jimu overdrive kit robots to teach kids STEM skills

  • Ubtech today unveiled the BuilderBot Overdrive Kit that lets kids ages eight and up build robots on wheels.
  • The kit aims to teach kids STEM skills and basic coding in a fun way.
  • With the Overdrive Kit, kids can make predefined DozerBot and DirtBot robots, or they can design their own creation.
  • The kit comes with both servo motors and DC motors with multiple gears to let the creations accelerate faster and decelerate smoother than previous models.
  • In addition to robots for kids, Ubtech makes a number of robotics products for people of all ages, like the Cruzr service robot.
  • The new Overdrive Kit will come with a newly updated Jimu app, which can handle pre-programmed or custom instructions.
  • Ubtech competes with a number of other robots designed to teach kids how to code, including Makeblock’s line of products and Anki’s Cozmo.

save | comments | report | share on

Ruby’s Hashes and Perl’s Autovivification, in JavaScript

  • Interestingly, Ruby hashes also have the notion of programmatically determine a default value to be returned when accessing keys that have not been set.
  • In essence, we’re deciding that at some point we will use Hash again, and at that time we can benefit from a single class multiple pieces of code can share, but we’d like to pay that cost now.
  • If we have to write our own Hash or HashMap class, fine, but we need good reasons to add the abstraction and maintenance cost to our code.
  • So whether we’re building a brand new Hash/HashMap class, or using the lightweight, idiomatic approach, we’re taking two steps forward with autovivifying hashes, we’re promoting the idea of a dictionary generating default values, and also promoting the idea that the entire process is recursive.

save | comments | report | share on

Avoiding Nulls with 'Tell, Don't Ask' Style (2010)

  • When dealing with possibly non-existent information, a Maybe type forces client code to be aware of, and deal with, the possible non-existence of information.
  • For example, if I have a Customer that may or may not have an email address, and that is exposed as a public accessor, I have to have some way to represent the case when the email address doesn't exist.
  • Now that the existence of the emailAddress is entirely hidden within the customer class, I'd be happy to replace the Maybe with a nullable reference, because that null won't pass between different objects and potentially cause NullPointerExceptions in far away parts of the codebase.
  • In this way I raise the abstraction level of programming of how to send updates to different customers from low-level procedural / algorithmic code containing conditional logic on the state of my objects up to high-level, compositional code that doesn't care about state.

save | comments | report | share on

You Think the Visual Studio Code Binary You Use Is Open Source? Think Again

  • Microsoft uses here a simple but clever trick allowed by the license of the code source of Visual Studio Code: the MIT license, a permissive Free Software license.
  • And of course Microsoft does not use purposely the MIT license for the binary of Visual Studio Code.
  • I may be wrong (again I’m not a lawyer), but it seems to me they forbid you to redistribute this binary, except for the conditions mentioned in the INSTALLATION AND USE RIGHTS section (mostly for the need of your company or/and for giving demos of your products using VSC).
  • About the GNU/Linux distributions, packaging VSC (see here for the discussion in Debian) would be a great way to avoid people being abused by the Microsoft trick in order they use a « product » breaking almost any term of what makes a Free Software.

save | comments | report | share on