Free ebook on java script




















Many of their programming structures are similar. However, JavaScript contains a much smaller and simpler set of commands than does Java. It is easier for the average weekend warrior to understand. The skill level of each sources vary from low to high, so feel free to pick whichever that fits your requirements. Have fun coding! Watch videos about books, reading and writing. Expect weird, amazing, never known before facts and many more. Forgetting for a moment who is responsible for this mishap, I'd like to pose the following question: who are the users of this code?

There isn't a clear-cut answer to this question. When bugs appear in the code, we can see how there can be massive unfortunate downstream effects. Should the original programmer of the package be concerned with all these downstream dependencies? When a plumber is hired to fix a tap on a sink, should they only consider the function of the tap itself, or the sink into which it pours?

When we write code, we are defining an implicit specification. This specification is communicated by its name, its configuration options, its inputs, and its outputs. Anyone who uses our code has the right to expect it to work according to its specifications, so the more explicit we can be, the better.

When people create software atop our code, we can't have any control over how they use it. But we can communicate explicitly about it, ensuring that its functionality is clear and expected. It's important to consider all use cases of our code, to imagine how it might be used and what expectations humans will have about it, programmers and end users alike. What we are responsible or accountable for is up for debate, and is as much a legal question as a technical one.

But the question of who our users are is entirely up to us. In my experience, the better programmers consider the full gamut of users, aware that the software they write does not exist in a vacuum. We've spoken about the importance of the user in programming, and how we must first understand what it is they wish to do if we are to have any hope of helping them. Only by understanding the problem can we begin to assemble requirements that our code will have to fulfill.

In the exploration of the problem, it's useful to ask yourself the following questions:. When we have assembled a complete understanding of the problem, we can then begin ideating, planning, and writing code to solve it.

At each step, often without realizing it, we will be modeling the problem in a way that makes sense to us. The way we think about the problem will have a drastic effect on the solution we end up creating.

The model of the problem we create will dictate the code we end up writing. Let's imagine for a moment that we are responsible for a note-taking application for students and are tasked with creating a solution to the following problem that a user has expressed:. We've decided that this warrants changes to the software because we've heard similar things from other users.

So, we sit down and try to come up with various ideas for how we could improve the organization of notes. There are a few options we could explore:. Each solution has its pros and cons, and there is also the possibility of implementing a combination of them. One thing that becomes immediately obvious is that each of these will quite drastically affect how users end up using the application. We can imagine how users exposed to these respective solutions would hold the model of note-taking in their minds:.

In this example, we're developing a UI, so we are sitting very close to the end user of the application. However, the modeling of problems is applicable to all of the work we do. Web programmers play a key part in deciding what models other people end up employing.

We should not take this responsibility lightly. The first point of failure is typically misunderstanding the problem. If we don't understand what users are truly trying to accomplish, and we have not received all requirements, then we will inevitably retain a bad model of the problem and thus end up implementing the wrong solutions. Imagine that this scenario occurs at some point before the invention of the kettle:.

Matthew asks no questions and immediately gets to work, excited at the prospect of putting his creativity to use. One day later he comes up with the following contraption:. We can see, quite obviously, that Matthew has forgotten one key component. In his haste, he did not stop to ask Susanne for more information about the user, or about their problem, and so did not consider the eventuality that a user would need to pick up the boiling-hot vessel somehow.

After receiving feedback, naturally, he designed and introduced a handle to the kettle:. This needn't have occurred at all, though. Imagine this kettle scenario extrapolated to the complexity and length of a large software project spanning multiple months. Imagine the headaches and needless pain involved in such a misunderstanding. The key to designing a good solution to a problem requires, first and foremost, a correct and complete model of the problem.

Without this, we'll fail before we even begin. This matters in the design of massive projects but also in the implementation of the smallest JavaScript utilities and components.

In every line of code we write, in fact, we are utterly liable to failure if we do not first understand the problem domain. The problem domain encapsulates not only the problem being encountered by the user but also the problem of meeting their needs via the technologies we have available. A good JavaScript programmer has to be adept not only in these technologies but also in understanding new domains of problems encountered by their users.

This entire book is concerned with teaching you how to write clean code in JavaScript. In the following chapters, we'll go into a lot of detail, with discussions of almost every construct within the language. Firstly, we need to establish a few key perspectives that'll be important when we think about what it means to write clean code for humans.

We can say that writing code for humans is broadly about the clarity of intent. And writing code for machines is broadly about functionality. These needs do cross over, of course, but it's vital to discern the difference.

We can see the difference if we were writing code only for the machine, focusing purely on function, and forgetting the human audience.

Here's an example:. Do you understand what this code is doing? You may be able to decipher what's going on in this code, but it is intent—its true meaning—will be almost impossible to discern. If we clearly express our intent then the preceding code would look something like this:. From the preceding code, we can discern that this function is intended to calculate the number of times a heart has beaten since birth.

There is no functional difference between these two pieces of code. However, the latter code better communicates the programmer's intentions, and thus is easier to understand and to maintain. The code we write is primarily for people. You may be building a brochure website, programming a web application, or crafting a complex utility function for a framework. All of these things are for people: people who are the end users of GUIs driven by our code or people who are the programmers making use of our abstractions and interfaces.

Programmers are in the business of helping these people. Even if you're writing code only for yourself, with no possibility of it being used in any way by anyone else, your future self will thank you if you write clear code. When we write code, it's essential to consider how human brains will consume it. Fellow programmers will scan over your code, reading the pertinent parts, attempting to gain a running comprehension of its inner workings.

Readability is the first hurdle that they must overcome. If they are unable to read and cognitively navigate the code you've written then they'll be less able to use it. This will drastically limit the utility and value of your code. JAVA in the other hand is ranked 1 using the same source above. Popular ebook formats are available but needs to be purchased. If you feel that the information is beneficial and helps you in various ways, try and help the author by purchasing them.

The sites listed below usually have various contact details that you can use. Shed some light on how to improve the structure of your web applications, opening doors to what will hopefully be more maintainable, readable applications in your future. This book shows how to build front-end web applications with plain JavaScript, not using any third-party framework or library.

Comes with the complete JavaScript code of 6 example apps, having 8, lines of code.



0コメント

  • 1000 / 1000