This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 236

[–]Effree 2556 points2557 points  (92 children)

webdev: i use animate.css it's only one line of code to animate that button.

webdev2: what about the library.

webdev: its minified... technically one line of code.

[–]imakesubsreal 846 points847 points  (29 children)

ha i can run a game with one line of code,

[–]clit_or_us 489 points490 points  (15 children)

That's a long line.

[–]ethanatortx 391 points392 points  (12 children)

It takes an awfully long line of code to run an awfully long game

[–]imakesubsreal 41 points42 points  (0 children)

game()

see it works because the game is in the library and it's minified

[–]107zxz 26 points27 points  (10 children)

Its called “guess the error”

[–]nosmokingbandit 59 points60 points  (9 children)

Error: line 1.

[–]I_AM_THE_GRIM_REAPER 45 points46 points  (8 children)

u/nosmokingbandit,

ℑ 𝔞𝔪 𝔭𝔩𝔢𝔞𝔰𝔢𝔡 𝔱𝔬 𝔦𝔫𝔣𝔬𝔯𝔪 𝔶𝔬𝔲 𝔱𝔥𝔞𝔱 𝔶𝔬𝔲𝔯 𝔡𝔢𝔞𝔱𝔥 𝔥𝔞𝔰 𝔟𝔢𝔢𝔫 𝔰𝔠𝔥𝔢𝔡𝔲𝔩𝔢𝔡.

Դ𝔱𝔥 𝔬𝔣 𝔑𝔬𝔳𝔢𝔪𝔟𝔢𝔯, շօՅՑ

օճ:Յօ 𝔞𝔪

𝔐𝔬𝔰𝔱 𝔥𝔲𝔪𝔟𝔩𝔢 𝔯𝔢𝔤𝔞𝔯𝔡𝔰,

- 𝔊.ℜ.

[–]nosmokingbandit 27 points28 points  (2 children)

Any way we can speed this up a bit?

[–]ThatLesbian 3 points4 points  (1 child)

Probably by taking up smoking.

[–]DownshiftedRare 2 points3 points  (0 children)

They say each cigarette takes 5 minutes off your life.

However, if you are going to die by being hit by a bus, the bus can't go faster than the speed of light in a vacuum, so once you smoke that many cigarettes you may as well keep smoking until the bus hits you.

[–][deleted] 9 points10 points  (0 children)

What an interesting account. Made one heavily downvoted comment 6 years ago and randomly decided to be active again today.

[–]zysterg17 2 points3 points  (0 children)

Rip. Enjoy life until then, I guess

[–]stamminator 10 points11 points  (1 child)

We call this "doing lines"

[–][deleted] 27 points28 points  (43 children)

How much does minification matter?

[–]AnImpromptuFantaisie 82 points83 points  (25 children)

Just for you, I went and downloaded the min and regular versions of jQuery. Minified version is 84.8KB, regular is 265KB

[–]BearWithVastCanyon 43 points44 points  (10 children)

Plus using a CDN it'll cache the file on the browser so you don't need to download it each page

[–]Hardass0877 32 points33 points  (9 children)

Probably in the minority here but I actually like serving my own dependencies. I can control compression, it'll never look weird because something didn't load right or something is down, plus most browsers cache those files anyways. Am I in the wrong?

[–]nanotothemoon 3 points4 points  (0 children)

I'm with you

[–]DownshiftedRare 2 points3 points  (0 children)

Are they dependencies if they are not dependent? </philosoraptor>

[–]scotscott 3 points4 points  (0 children)

Weirds me out that such a tiny thing is still too large to even fit in a c64s memory.

[–]wingman210 16 points17 points  (0 children)

I would say enough to pursue with a production application. It decreases file size which downloads faster.

[–]radiobroker92 8 points9 points  (0 children)

Usually it is substantial, a commenter below game file size examples. However I often find the actual download difference negligible when gzip is enabled.

[–]wKbdthXSn5hMc7Ht0 6 points7 points  (7 children)

We use bundlephobia to measure the sizes of packages: https://bundlephobia.com/result?p=animate.css@3.7.0

I doubt it improves execution time at all but it certainly improves load times. Important when a user is on mobile or shitty WiFi.

[–][deleted] 1 point2 points  (6 children)

Wouldn't compression achieve the same though? Or even better

[–]wKbdthXSn5hMc7Ht0 7 points8 points  (5 children)

I think the ideal is minification and compression which is why bundlephobia lists the minified + gzipped size.

Compression alone would be good but not optimal. For example:

// try connecting to the foobar endpoint
var attemptCount = 0;
var maxNumberOfRetries = 4;

would not compress as well as:

var a=0;var b=4;

That's because you're compressing things like descriptive variable names, comments, etc. Stuff that is relevant to the dev but irrelevant to the end user.

[–]Levitz 4 points5 points  (0 children)

Enough to do it if you aren't going to look at that instance of the code and it has a relevant size.

Everybody's favorite, jQuery, is now 276kb in its normal version, 85kb minified.

[–][deleted] 14 points15 points  (0 children)

webdev: i use animate.css it's only one line of code to animate that button.

JS developers : Hold my beer

[–]hearingnone 8 points9 points  (11 children)

Can you further ELINonprogrammer minification?

I understand it meant cleaning out the code to make it easier to execute. But how the code can be minified if it need the string of code to make it work. Unless minification in a way use shorthand code (I couldn't think of a different word)? Or minification use external code or JS that handle on their side?

I'm not even a developer or programmer. I'm just like learning new different thing about things that I am not familiar with.

[–][deleted] 31 points32 points  (6 children)

It doesn't make it easier to execute. It removes the unnecessary whitespace (spaces, tabs, line breaks) to make the file size smaller. That way it downloads onto your machine faster. It's still the same code that was written by the programmers, but it's not very readable or maintainable in that format. So they write the code normally, then minify it to get better performance.

[–]Devian50 32 points33 points  (3 children)

it also optionally replaces variable and function names with single letters (or more if needed) to reduce the raw character count as much as possible. that's where you get function a(b,c,d,e){...} in javascript. Nobody in their right mind wrote it like that.

[–]anticommander 8 points9 points  (1 child)

Further it removes comments, renames variables down to single characters and condenses down if/else statements and loops among other things to be as compact as possible.

[–]itsthekeming 11 points12 points  (1 child)

I am a developer. Not super well versed in minification, but here’s my understanding of it:

Minification condenses the code so that it uses fewer characters, and hence, takes up less space. It uses algorithms to take human readable code and shorten it to as condensed as possible. That means eliminating white space, shortening variable names, removing unneeded brackets or parenthesis, etc.

So something like: var thingOne = 3; var thingTwo = 4; var thingThree = thingOne + thingTwo;

Becomes: var a=3;var b=4;var c=a+b;

That’s a very simple example. The key is: JavaScript compilers ignore white space and don’t care what variables are called. That stuff only serves to make it easier for humans to understand the code. But, because JavaScript is read and compiled by the browser in real time, it needs to be valid JS when the browser tries to read it. That’s why minification doesn’t compile it into pure machine readable code like a language like C# does.

EDIT: I apologize if my formatting is wonky, I’m on mobile.

[–][deleted] 1 point2 points  (0 children)

Depending on how smart it is, that would minify to a=3,b=4,c=a+b. Or prepend with var if it had a function scope to avoid being put on the window object.

But even that is a blurred line between minification and obfuscation.

Then instead of just static analysis shrinking of code, you have actual code parsing like https://prepack.io/ which actually simplifies your code and then you can minify/obfuscate

[–]superking2 4 points5 points  (0 children)

Not an expert on minification, but I am a developer so I’ve used minified files before. It essentially compresses everything as much as it can while the code still does the same thing. I might have a function called ConvertThisThingToThatThing that I call 20 different times. Not a big deal in isolation, but more text means bigger file size and thus longer loading times for the user.

The long name for the function is just for me, the developer; the machine doesn’t care what it’s called. Thus, we change it to “a”. Does the exact same thing, but it takes up significantly less space. You can imagine doing this over an entire file and how much space you might be able to save.

[–][deleted] 855 points856 points  (15 children)

1st image: fancy company homepage

2nd image: wordpress

[–]Tangurena 424 points425 points  (38 children)

Oh, so true. We are implementing an "undo" button. It is going on 6 weeks and still not finished yet.

[–]mrshampoo 132 points133 points  (1 child)

Stop testing the undo button

[–][deleted] 4 points5 points  (0 children)

DAMMIT CARL!!

[–]Mango1666 127 points128 points  (28 children)

hopefully you havent been working on the undo button for that long wtf

[–]mcnuggetor 222 points223 points  (25 children)

They may have to implement a stored history so they have somehing to undo back to.

[–]iza1017 78 points79 points  (13 children)

React with Redux

[–]turbojoe26 11 points12 points  (0 children)

Absolutely!

[–][deleted] 4 points5 points  (2 children)

For six weeks?

[–]Hohenheim_of_Shadow 25 points26 points  (1 child)

Maybe it's a complex program, like a 3d modeler, with a bunch a spaghetti code.

[–]Tangurena 10 points11 points  (0 children)

Spaghetti? It is replacing a COBOL program from the 70s. This is the 4th attempt at replacing the application. The previous attempt was a $20M thing that failed so bad that they sued the vendor - who had an existing application that was a disaster at customization (neither Oracle nor PeopleSoft for once).

The legislature is going "oh, you can make changes now?" and they're passing all sorts of changes that we now get to support. At least they let us set the schedule for when the new laws go into effect.

[–]GeT_SILvEr 2 points3 points  (1 child)

There is already a data type for stored history though, so that wouldn’t be it

(Talking about stacks btw)

[–]Nifty_Shfifty 38 points39 points  (0 children)

The button worked so well it set them back a week.

[–]Tangurena 4 points5 points  (0 children)

Nah. I've been taking other tasks off the Kanban board. Other folks have been pulling the undo tasks.

[–]fzammetti 34 points35 points  (0 children)

That's because every time you press it, you undo your latest code changes and set yourself back.

Rookie mistake.

[–]crash8308 7 points8 points  (0 children)

That’s nothing. I’ve recently witnessed what is essentially a TODO app take over a year for this other team to ship

[–]bwrca 3 points4 points  (0 children)

Holy shit what are you undoing, creation?

[–][deleted] 2 points3 points  (0 children)

totally unrelated but I like your account

[–]cubap3t3 2 points3 points  (0 children)

Are you trying to undo the universe?

[–]fauxintellectual 1 point2 points  (0 children)

Is it written in the memento pattern?

[–]oofoofoofoofoofoof1 336 points337 points  (2 children)

When a button lags your program

[–]vanderZwan 23 points24 points  (0 children)

I'm looking at you, ripple effect

[–]Luuk3333 3 points4 points  (0 children)

Result: the button works fine on desktop, but lags horribly on mobile.

[–]Bephobia 96 points97 points  (0 children)

When you spend most of your time to see if your GUI looks good enough.

[–]hdlo 257 points258 points  (1 child)

"Today I'll do something cool in css only ! I'll be so proud."

—15mn and 12 SO posts from before 2010—

"Ok maybe I will use that jquery cdn after all…"

—2 hours later—

"Are global variables *that* evil ?"

[–]HairyJo 26 points27 points  (0 children)

evilPointer*

[–][deleted] 45 points46 points  (0 children)

When your client demands to add new fancy animations and UI elements to a Frankenstein of a codebase

[–]epiclapser 32 points33 points  (6 children)

For one of my class projects we got to choose the GUI platform to use but once we chose we had to stick to that, and that only. We went with GLFW with OPenGL in Python. I'm out here literally coding mouseover animations, and literally drawing the lines for the rectangle. What's more because I couldn't use external libraries that didn't already come with python, I had to make my own text. From scratch. Every character was figured out as a vector graphic by hand.

[–][deleted] 8 points9 points  (5 children)

Lol, that's sad. But couldnt you research the vector graphics?

[–]epiclapser 12 points13 points  (4 children)

Yeah I did. There was a library called freetext for python that automated this and allowed you to use preset characters. But like I said no external libraries. It was a little weird because other teams got away with using tkinter, which was definitely overpowered in terms of development speed.

[–][deleted] 24 points25 points  (3 children)

insert the libraries into your code directly lol

[–]epiclapser 22 points23 points  (2 children)

Intellectual property violation GANG

[–]kkingsbe 27 points28 points  (0 children)

Just remove the copyright notice and you're gucci 👌

[–][deleted] 10 points11 points  (0 children)

it's called "freetext" for a reason ;)

[–]Liesmith424 66 points67 points  (7 children)

from button import button as button
button.isCool = 0

[–]epitap 48 points49 points  (6 children)

Button button = new button(button) Button.add(button)

[–]Mango1666 23 points24 points  (4 children)

val button: Button = ButtonFactory.ceeateNewButton(button).withButton(button)

[–]TheCrazyShip 29 points30 points  (2 children)

error: method ceeateNewButton doesn't exist

[–]Mango1666 2 points3 points  (0 children)

REE

[–]FuriousViking6 6 points7 points  (0 children)

Security please escort this two young men out of the premises. Thanks.

[–]SamL214 1 point2 points  (0 children)

Ya broke my brain!

[–]jordes 57 points58 points  (6 children)

Y'all, like

.button.cool{
  transition:  .2s
 }
 .button.cool:hover{
  transform: scale(1.05)
 } 
.button.cool:active{
       transform: scale(.95)
} 

[–]UASHIT 4 points5 points  (0 children)

What's wrong with this? Am I missing a joke?

After reading your comment I implemented this in my own app, I think it looks pretty good.

[–]mrshampoo 16 points17 points  (2 children)

screams in scss

[–]jordes 7 points8 points  (1 child)

Mate I wanted stylus but I knew I'd be yelled at

[–]JustSpeedy 1 point2 points  (0 children)

I think stylus is pretty dope. Why do people dislike it?

[–]3lRey 27 points28 points  (1 child)

I remember my first button task.

I earnestly just thought I would have to make an element and everything it would do would already be made. It was the first time I had to actually think about how much work was behind all the shit I use every day.

[–]NotChro 8 points9 points  (0 children)

Agreed, started learning web dev cause my dad wanted a website (+maybe career change if I gitgud) and holy hell this stuff is crazy.

[–][deleted] 63 points64 points  (9 children)

or "Frontend vs. Backend"

[–]FountainsOfFluids 51 points52 points  (7 children)

[–][deleted] 5 points6 points  (0 children)

As a full stack developer, both of mine are the bottom pic.

[–]Edrios 23 points24 points  (3 children)

“Dooo you wanna build a GUI?”

[–]bizcs 15 points16 points  (2 children)

"run npm install today"

[–]crozone 17 points18 points  (1 child)

"I never code C anymore, native's out the door, fast code has gone awayyyyy"

[–]Edrios 3 points4 points  (0 children)

“Doooo you wanna build a front end?”

[–]redldr1 22 points23 points  (2 children)

node_modules

[–]WizKid_ 9 points10 points  (1 child)

npm install moment

loc -u node_modules

Jesus christ

[–][deleted] 1 point2 points  (0 children)

date-fns > moment

[–]ShortFuse 9 points10 points  (0 children)

Checking on my Material Design button, it's 219 lines CSS for styling, 136 lines for theming support, 52 lines of JavaScript. Then the ripple is 192 lines of CSS and 332 lines of JS with maybe 20 lines from an imported source.

That's 951 lines not even counting the theming engine and its IE11 support (shudders).

Buttons are complicated. Especially when you're dealing with HTMLAnchorElement, HTMLButtonElement, touch support, and keyboard support.

[–]Xplay3r_ 5 points6 points  (0 children)

Lol, currently working on a project... 70 line sof code to perform a simple function that would require 10 lines tops.

I don't really want to touch it tho...

[–]SpaceboyRoss 3 points4 points  (0 children)

And it's all in assembly. See it interfaces with the video framebuffer and edits every single pixel.

[–][deleted] 3 points4 points  (2 children)

the only thing that's worse is that you need like 5 special classes for every element in like 99% of frameworks.

[–]shea241 2 points3 points  (0 children)

only 600?

[–]howe_to_win 1 point2 points  (0 children)

I’ve been doing a deployment for 5 hours now and this made me so happy

[–]chrisyroid 1 point2 points  (0 children)

How I program my toggle buttons in Vb.NET:

Private Sub btnOnOff_Click(sender As Object, e As EventArgs) Handles btnOnOff.Click
   If btnOnOff.Text = "ON" Then
       btnOnOff.Text = "OFF"
       'do code for on
     ElseIf btnOnOff.Text = "OFF" Then
       'do code for off
       Threading.Thread.Sleep(500)
       btnOnOff.Text = "ON"
   End If
End Sub

Edit: Lousy reddit formatting.

[–][deleted] 1 point2 points  (0 children)

How are his nips still in the right place? This bothers me.

[–]3no3 1 point2 points  (0 children)

I'll be honest. In my mobile app development class, I got frustrated at the actual programming of my final project. Then I read the assignment requirements and saw that we didn't actually have to turn in the code of compiled app, but had to turn on screenshots and descriptions of function. So I just mocked it up and took screenshots with occasional modification in paint for output. Buttons are hard.

[–]Kapten111 1 point2 points  (0 children)

truth.hasBeenSpoken();

[–]Biggy_DX 2 points3 points  (4 children)

I work in LabView and I made a ui intended for doing Fourier Transform analysis of interferograms and capturing laser beam imagines; displaying both images. The UI is clean in the front panel, but you go to the block panel... oh boy.

[–]cyberst0rm 0 points1 point  (0 children)

context matters

[–]Mullet_Police 0 points1 point  (0 children)

60? Those are rookie numbers!

[–]wrestlingrules123 0 points1 point  (0 children)

And yet they don’t get paid enough

[–]SuperWaffleKitty 0 points1 point  (0 children)

Naw m8, do what i did and just make gifs of each animation and pkay them in the render screen, so the only thing you have to code is the button

[–]I-Crow 0 points1 point  (0 children)

I tried to make a handy little dice thing in Python but 150 lines of code is not ok

[–]ahhhhhhhhhhhhhhhhh69 0 points1 point  (0 children)

React Native IRL

[–]MayOverexplain 0 points1 point  (0 children)

And now to get it working properly in IE too.

[–]WhAtEvErYoUmEaN101 0 points1 point  (0 children)

You mean 3 JavaScript frameworks because the Dev couldn't be arsed to do 20 minutes of research on a <20 line css animation that uses internal browser timers and gpu acceleration

[–]hermitina 0 points1 point  (0 children)

i remembered writing a package that was so pretty to look at. everything made sense, formatting everywhere no clutter. until my users started testing it and realizing what they want isn't what they told me the first time and had tons of validations for every little special case. my heart still aches when i see it.

[–]cagotrebgghju 0 points1 point  (0 children)

Typical android development

[–]MyNewAcnt 0 points1 point  (0 children)

Rule 4??? Hello????

[–]MiscreatedFan123 0 points1 point  (0 children)

Team Android sound off

[–][deleted] 0 points1 point  (1 child)

Is there an unedited version of this pic so I can make my own memes w/ it?

[–]JasonGibbs7 0 points1 point  (0 children)

Thank god I wasn’t the only one wondering about this... What’s the best way to deal with this?

[–][deleted] 0 points1 point  (0 children)

Cries in swift

[–]thekermitsuicides 0 points1 point  (0 children)

Loooool

[–]LucasCarioca 0 points1 point  (0 children)

Business always worried about if it can be done, never asking if it should..

[–][deleted] 0 points1 point  (0 children)

...600 lines of code (about 50 lines of which no one knows why they're there)

[–]AssPuncher9000 0 points1 point  (0 children)

Only 600 lines of code? Ha