Posts: 7677
Threads: 635
Joined: January 19, 2013
Reputation:
30
Websites that work on mobiles and desktops alike (Responsive)
February 12, 2018 at 4:13 am
(This post was last modified: February 12, 2018 at 4:16 am by WinterHold.)
I wanted to share my knowledge about programming websites that work on both mobile phones and also desktop computers.
To produce a functional, responsive website that works on both mobiles and desktop with a single HTML file; you have to use an external framework, or add what we call "media queries" to your .CSS site layout by yourself. You can also combine both.
I should note; that Frameworks and Libraries provide you media queries, in the form of classes.
The structure of your file should look like:
================
1-HTML file
2-CSS file
3-Frameworks and Libraries (they are read in the HTML; composed of .CSS and .JS)
=================
Frameworks like twitter's bootstrap, allow you to use number 3 in your website: give your HTML the ability to produce a single code; that runs cleanly on mobiles and PCs alike.
It extends the HTML, by providing "CSS classes" and "Javascript scripts" that promise a wonderful design.
Design Well !
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
45
RE: Websites that work on mobiles and desktops alike (Responsive)
February 12, 2018 at 7:17 pm
(This post was last modified: February 12, 2018 at 7:18 pm by bennyboy.)
In my experience, media query + a little javascript is plenty powerful enough: I would definitely shy away from libraries in favor of hand-designing everything myself.
Production libraries tend to put out pretty complex-looking code, and I've sometimes spent more time trying to figure out how the heck something was supposed to work (so I could add to it or customize it) than it would have taken me just to create the functionality from scratch.
Overall, I'd say this is the rule: the less you know, the more productive you will be with 3rd-party solutions as compared to doing things by hand. The more you know, the less you will want to learn the features of this-or-that new thing, and just get straight into organizing your project
The only exception is really big things that you could never do on your own-- graphic engines, complex statistical analysis, AI, etc. (assuming you haven't spent the time to learn about these things)
Posts: 7677
Threads: 635
Joined: January 19, 2013
Reputation:
30
RE: Websites that work on mobiles and desktops alike (Responsive)
February 14, 2018 at 11:25 pm
(February 12, 2018 at 7:17 pm)bennyboy Wrote: In my experience, media query + a little javascript is plenty powerful enough: I would definitely shy away from libraries in favor of hand-designing everything myself.
Production libraries tend to put out pretty complex-looking code, and I've sometimes spent more time trying to figure out how the heck something was supposed to work (so I could add to it or customize it) than it would have taken me just to create the functionality from scratch.
Overall, I'd say this is the rule: the less you know, the more productive you will be with 3rd-party solutions as compared to doing things by hand. The more you know, the less you will want to learn the features of this-or-that new thing, and just get straight into organizing your project
The only exception is really big things that you could never do on your own-- graphic engines, complex statistical analysis, AI, etc. (assuming you haven't spent the time to learn about these things)
The problem is the time; but writing everything by your own is the best thing for developing your skills and sharpen the results of your code, but it takes a lot of time and effort.
But I won't argue with you: building your own stuff makes you dodge the complications of trying to understand the codes of others.
The bold part is spot on. If I understand it probably; you will focus your strength one thing: either the 3rd party framework, or your own developed stuff.
Your own= more bare knowledge in the environment you're using
Framework=more knowledge in that framework; not in the environment
Ah; I only used "Blender" and "Three.js" for a very short time if that counts as graphic design. Very short like a month, but it wasn't for me so I quit.
For A.I, I only developed a chess game and "Wanted" to seed an "NPC opponent" with moves via Neural Networks, I didn't do that; I didn't even research Neural Networks probably.
Posts: 6859
Threads: 50
Joined: September 14, 2014
Reputation:
43
RE: Websites that work on mobiles and desktops alike (Responsive)
February 15, 2018 at 9:37 am
If you are a coder by profession and still get time to hand-code everything to your liking, then do consider yourself as one of the luckiest people on this planet.
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 Cool Shades](https://atheistforums.org/images/smilies/cool-shades.gif) (pester tibs via pm if you need invite)
Posts: 43162
Threads: 720
Joined: September 21, 2008
Reputation:
132
RE: Websites that work on mobiles and desktops alike (Responsive)
February 15, 2018 at 10:53 am
Most of them.
Posts: 7677
Threads: 635
Joined: January 19, 2013
Reputation:
30
RE: Websites that work on mobiles and desktops alike (Responsive)
February 16, 2018 at 12:48 am
(This post was last modified: February 16, 2018 at 12:48 am by WinterHold.)
(February 15, 2018 at 9:37 am)Aoi Magi Wrote: If you are a coder by profession and still get time to hand-code everything to your liking, then do consider yourself as one of the luckiest people on this planet.
Exactly, it takes hell lot of time, and copy-pasting from the web to save time, will produce tiny little errors here and there -a missing bracket; something extra copied by mistake...etc-.
(February 15, 2018 at 10:53 am)Hammy Wrote: Most of them.
huh?
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
45
RE: Websites that work on mobiles and desktops alike (Responsive)
February 16, 2018 at 1:39 am
(This post was last modified: February 16, 2018 at 1:51 am by bennyboy.)
(February 15, 2018 at 9:37 am)Aoi Magi Wrote: If you are a coder by profession and still get time to hand-code everything to your liking, then do consider yourself as one of the luckiest people on this planet.
The difference between coding and scripting is probably a philosophical one. I feel that no matter what tools you are using, you need to have access to a low enough level that you can make custom solutions at a customer's request.
For example, I use ASP.NET. It has built-in controls that I use to quickly put together a page. However at all points in that process, I'll be looking at the HTML the site pumps out, and if I can't get at what I need, I'll either patch it with Javascript client side, or I'll program my own.
HTML has the advantage of being very simple. You probably aren't going to be writing new face-recognition algorithms or anything, you are pretty much just pumping out HTML over the pipe. There's probably no .ASP control that you couldn't write (at least in a form specific for your needs) in a couple hours, I'd think.
Posts: 5466
Threads: 36
Joined: November 10, 2014
Reputation:
53
RE: Websites that work on mobiles and desktops alike (Responsive)
February 17, 2018 at 12:10 am
This is exactly why I like using frameworks and other middleware. With a package manager (in my case, Composer... think Nuget, npm, etc.), I can install 3rd party components, but the existing framework/middleware allows me to write custom code easily if necessary. Like, right now, my data entities are a mix of 3rd party components (for users, and for an implementation of the nested set algorithm), but with my own code extending it.
Posts: 9147
Threads: 83
Joined: May 22, 2013
Reputation:
45
RE: Websites that work on mobiles and desktops alike (Responsive)
February 17, 2018 at 4:08 am
(This post was last modified: February 17, 2018 at 4:50 am by bennyboy.)
Regarding data.
I just migrated from an old 3rd-party (and crappy) physical server to an Azure VM. Ho. . . ly. . . crap!
It performs better than a fully managed server at a small fraction of the cost, and with way fewer problems. No more talking to retarded tech dummies who don't know how to upgrade .NET or how to back things up or whatever.
Posts: 2020
Threads: 133
Joined: July 26, 2017
Reputation:
5
RE: Websites that work on mobiles and desktops alike (Responsive)
February 17, 2018 at 10:11 am
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.
|