Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: April 19, 2024, 8:20 pm

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Websites that work on mobiles and desktops alike (Responsive)
#11
RE: Websites that work on mobiles and desktops alike (Responsive)
(February 17, 2018 at 10:11 am)FlatAssembler Wrote: Anyway, when do you think it's advisable to use server-side scripts instead of the client-side scripts?
Of course, sometimes you have to use server-side scripts to store the data (like when making the comment sections or a global high score list on a game), but when should you use server-side scripts to manipulate the data?
If you make an error in a client-side script trying to manipulate the data, the worst thing that can happen is that the browser crashes (which has actually happened to me a few times when using Safari or Internet Explorer). If you make an error in a server-side script, well, your website can easily become inaccessible.

JavaScript can be turned off. A not-insignificant number of people run their browsers with the NoScript plugin (or equivalent) in an attempt to block ads and malicious client scripts.

Regarding errors, program defensively. Exception handling is a thing that's built into just about every language I can think of. Never just blindly accept user input (especially if it's text or a file upload). Run unit tests as you write your code (which, I mean, I've mentioned several times now).

No one doing this for real just writes code and hopes it doesn't break. We take the extra time to account for both errors and malicious users. It's part of the development process.
Reply
#12
RE: Websites that work on mobiles and desktops alike (Responsive)
I will straight up tell users they must have JavaScript turned on, and recommend that they keep cookies on as well-- though the site won't actually break with no cookies, they help a lot.
Reply
#13
RE: Websites that work on mobiles and desktops alike (Responsive)
To me it seems like doing something on a server that can be done on a client is just making things more complicated for very little benefit. JavaScript appears to be an excellent language for complicated string and array manipulation. To make a simple arithmetic-expression-to-assembly converter that runs in IE6 (like this), it takes 600 lines of JavaScript. How many lines of code would it take to do it in a language such as C++ (so that it runs on the server)? I come from the world of competitive programming, and I still wouldn't know how to do it in C++. My guess is that it would take well over twice that many lines of code just to implement the algorithm. And, if you do it JavaScript, you don't need to care about error-handling so much. If you type "(*)" as an arithmetic expression, the parser simply exits due to an uncaught exception. If you do it in C++ on the server and don't implement error-handling (which is again easier to do in IE6-compatible JavaScript than in C++), the user could easily, even unintentionally, crash your site. Would it run faster? Maybe a little, but a way to make it signifficantly faster would be to implement the Shunting-Yard algorithm instead of using a recursive parser (which is also easier to do in JS than in C++). The only potential benefit from doing anything server-side would be that, if you are ready to write around 10'000 lines of code, you could make it possible for the user to directly download the binary file (without having to assemble it himself). Do you think I am missing something?
Reply
#14
RE: Websites that work on mobiles and desktops alike (Responsive)
You are still not, I think, really getting the point of web pages. HTML is a markup language-- it is meant to send you data and tell your browser in simple terms how to arrange that data on the screen. What's missing? Heavy processing. That, to be blunt, is the server's job.

Making the client do the heavy lifting is bad manners. I will use up CPU bandwidth, and will drain a phone user's battery faster. If you really want to do this, then you should use an environment like Xamarin that will let you write cross-platform apps.

The other thing is that the client can SEE what you've done in java script by right-clicking and inspecting your page. So if you've made anything of any value, you can pretty much kiss your exclusive rights to it goodbye. Doing that on this here website, for example, might teach you a lot about how the site works. Server side code, on the other hand, is 100% hidden: nobody knows, or CAN know, anything about how your site arrives at code.
Reply
#15
RE: Websites that work on mobiles and desktops alike (Responsive)
(February 19, 2018 at 6:43 pm)bennyboy Wrote: Server side  code, on the other hand, is 100% hidden: nobody knows, or CAN know, anything about how your site arrives at code.

Umm, just never say the server-side code is "100%" hidden. nothing is that secure... nothing! Sleepy
Quote:To know yet to think that one does not know is best; Not to know yet to think that one knows will lead to difficulty.
- Lau Tzu

Join me on atheistforums Slack Cool Shades (pester tibs via pm if you need invite) Tongue

Reply
#16
RE: Websites that work on mobiles and desktops alike (Responsive)
(February 19, 2018 at 6:49 pm)Aoi Magi Wrote:
(February 19, 2018 at 6:43 pm)bennyboy Wrote: Server side  code, on the other hand, is 100% hidden: nobody knows, or CAN know, anything about how your site arrives at code.

Umm, just never say the server-side code is "100%" hidden. nothing is that secure... nothing!  Sleepy

If you have your drapes closed, and someone uses an X-ray camera to see you in your undies, that's on them, and they've done something criminal.  If you stand in front of an open window doing your nude yoga, then you might as well wave to the camera and say, "Hi mom!" Big Grin

Server side code is hidden in the sense that nothing in the webpage content will reveal how I've arrived at the marked up data.  For example, the OP has written logic to create an imaginary phoneme set to compare against real ones for educational purposes.  By doing that in JS, anybody can and will come along, copy and paste it to their own site, or write a bot to manipulate the tests results over a hundred thousand tries to throw off the data he's trying to collect, or whatever.
Reply
#17
RE: Websites that work on mobiles and desktops alike (Responsive)
And what do you guys here think, is the intellectual property a form of an actual property, or is it merely a rhetoric used to justify the censorship?
If you give somebody an idea, you don't lose that idea yourself (as if you gave him something tangible), but both of you then have an idea how to benefit the society. Copying someone is just expressing the idea that you have got by perceiving what someone else has done, and if the government stops you from expressing an idea that you have, that's a form of censorship, right?
Reply
#18
RE: Websites that work on mobiles and desktops alike (Responsive)
Intellectual property is property. And there are rules about what constitutes it (see Oracle vs. Google for interesting examples).

Now, general ideas don't fit the bill. Lyft and Uber don't infringe on each other just because they're both ride sharing services. Same with Coke and Pepsi, or any of the other products and services that compete with each other. No, what counts are assets (graphics, music, etc) and proprietary means of production (chemical formulas, recipes, non-open source code).

If I make an awesome game, it's totally okay for another person to make something similar (see: PUBG and Fortnite's new arena mode). What's not okay is if they steal (or perfectly recreate) my game's assets, or if they steal my code.

It has nothing to do with censorship, but rather with theft. Not everything is open source, and not everything should be.
Reply
#19
RE: Websites that work on mobiles and desktops alike (Responsive)
To me, there's a grey area: publicly viewable code. I normally wouldn't think it's okay to take pictures of my naked neighbor doing yoga, if she's made even a gesture of covering up. But if she's stretching in front of a huge living-room window in clear sight of a main street-- hmmmm. . . it seems to me there's an implicit understanding that she's fine with her image being considered public.

I kind of feel the same about javascript. I actually have alot of JQuery trickery in some of my sites that would be very useful to my competitors-- if they had the wherewithal to study it. But I pretty much assume that they will steal it if they can, because it's so publicly visible.
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  religious websites are a greater security risk than porn destinations. Ziploc Surprise 3 2819 June 20, 2012 at 6:57 pm
Last Post: Angrboda



Users browsing this thread: 1 Guest(s)