how do you model your javascript? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to model my javascript object using visio, visio doesn't support javascript data types.
Then I start thinking, how do you desing model your javascript code?
Cheers

In the past, I've used Open Source tools like Dia and just fudged the data types where needed...
It's enough to get the idea across, but you're definitely not going to get anything even close to code generation from it.

I prefer Object Oriented design - even for JavaScript - so I suggest Rational Rose. I like some of the features of OO (e.g. encapsulation and abstraction) and like to add some discipline to a potentially undisciplined environment - especially when working with developers new to JavaScript. Rose meets my needs.

Related

Why does JavaScript have the Math object? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
In many languages, to find cosine, you use cos(x). But in JavaScript, you must use Math.cos(x). Why doesn't JavaScript spare us the 5 characters in Math., both making it easier to type and easier to read?
I have tried to Google this multiple times, and found no answers. Is there any practical reason for this that I have not yet found?
So far, there are three reasons I can think of:
The creators of JavaScript want to ensure that the math functions do not coincide with other functions users create (Like a function called 'cos()` that calculates, say, cosecant)
The creators of JavaScript thought that Math would make the code more readable
The creators of JavaScript perhaps didn't want any functions that have window as a parent (Though alert and prompt make this unlikely)
To hold the math functions without polluting the global namespace.

How to create objects with javascript / jquery [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm currently working on a web page where you can add many different "machines" and then specify certain things about each one.
My original thought was to create div's for each machine (which would contain common elements like "name", "operating system", etc), and then change the IDs according to the names. That being said, is this really the best approach? Is there some way to use javascript/jquery to essentially make classes?
I also read briefly about some javascript template libraries like mustache, but did not get too into them.
Not looking for you to write the code for me -- just wondering how I should approach this
Yes, you can use an array of JSON objects for this.
A Javascript library that supports model binding like AngularJS or Knockout can make displaying all the "machines" very easy with their foreach functionality.

How to start with javascript code obfuscation? Not looking for tools [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would love to learn how to do javascript obfuscation. I have been searching through the web but I have not found anything to start with. Only posts about tools and more tools...
Is there any book?
What techinques are there?
Can someone show me some link to understand javascript obfuscation?
There are several ways to do it?
Is this explained in the javascript or ecmascript documentation?
I'm not looking for any tool. I only want to understand it and learn it.
The most comprehensive obfuscation method is converting all JavaScript code to non-alphanumeric characters. This blog post covers how it works and links to a converter tool in case you change your mind.

What to learn after JavaScript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've recently finished watching some beginner JavaScript tutorials; it's quite easy to understand. I'm trying to look for intermediate ones now, but I can't find any. So I've decided to not waste time while looking for some continuation on my JavaScript journey. What should I learn next? I prefer that which is important, and perhaps, closely related to JavaScript.
It depends on what your goal is, and what you have already learned.
If you want to become a web developer, you should learn some server-side web languages like PHP or ASP.NET.
If you want to become a general developer, it would be useful to know systems languages like Java or C++.
If you want to be a computer scientist, studying algorithms might be a good start.

Should source code know it's being tested? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a complex codebase with tight couplings between functions and I am not able to write unit tests easily.
Should source code know about testing environment, should it know it's being tested?
To indicate it's being tested or so can be easily via global flag but I have a fear it may cause a bigger mess in the long run.
In short, no.
Your code should be written in such a fashion that it is testing-agnostic. What I mean is that it shouldn't care if it is being tested or not. Because of your 'tight couplings' I would suggest that you do your testing as manually as you can since that would give you the best litmus test of it working as expected.
Also, if your code is implemented well enough it would also be environment agnostic. Whatever environment you test in should be as close to real-world as possible.

Categories

Resources