Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Wheany posted:

i have to poast onge again that i hate how every programming related course is so loving concerned about performance when discussing things like patterns.

strategy pattern pros: you can change the implementation on the fly, cons: you have to call a function from a virtual function table :ohdear: (which is what they mean by slightly decreased performance)

the actual problem with the strategy pattern is that it is trivial and not worth discussing (all gof patterns are either trivial inclusive-or dumb, and most of them are papering over flaws of early c++ and java rather than actual language-agnostic designs)

Adbot
ADBOT LOVES YOU

Brain Candy
May 18, 2006

Otto Skorzeny posted:

the actual problem with the strategy pattern is that it is trivial and not worth discussing (all gof patterns are either trivial inclusive-or dumb, and most of them are papering over flaws of early c++ and java rather than actual language-agnostic designs)

and surprise, the performance analysis hasn't been updated since then either

can yospos come together and hate on people who use patterns as prescriptions rather than descriptions?

Bloody
Mar 3, 2013

mnd posted:

Actual PL inquiry: has anyone here used Julia for anything (on Windows)? Does it run/install?

I'm hoping it's a better situation than trying the current stable Rust builds on Windows but I haven't tried yet.

Also, people interested in (simple, 2D) games programming should check out and play around with strlen's Lobster.

use linux where it works trivially

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Brain Candy posted:

and surprise, the performance analysis hasn't been updated since then either

can yospos come together and hate on people who use patterns as prescriptions rather than descriptions?

holy poo poo yes. last spring we had to design a music streaming service, like spotify, as a group exercise. we were give a bunch of requirements and we had to make all kinds of diagrams of the different parts and their connections and all that kind of crap.

after some review, the reviewer recommended that we use "the strategy pattern" in one part that had to have some interchangeable behavior and then every time we had a team meeting that concerned that part, my team members could not stop talking about how that part needs to use strategy specifically, and then they made a loving point of mentioning that in the following reviews.

i agree that the pattern names increase the vocabularity we can use when talking about designs, but it's far more important to realize that the concepts exist. then when you're planning something or even coding something you might afterwards realize that you have used a "visitor" here and a "decorator" there

double riveting
Jul 5, 2013

look at them go

Otto Skorzeny posted:

(all gof patterns are either trivial inclusive-or dumb, and most of them are papering over flaws of early c++ and java rather than actual language-agnostic designs)

how many university departments could be shut down in favor of actual science if this wisdom became common...

Bloody
Mar 3, 2013

is object oriented a design pattern? if so, that's the one i use

Nomnom Cookie
Aug 30, 2009



oh no virtual functions. dereferencing a pointer TWICE!!! performance is DEAD

jvm will optimistically devirtualize call sites when profiling detects that the target always has only one or a few types. then the cost of a virtual call is reduced to an untaken branch + regular call. hotspot bithc

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
"slight performance penalty" always means either virtual function call or object instantiation

and then the example code uses variations of bubble sort to make its point

Nomnom Cookie
Aug 30, 2009



design patterns are a good idea. gof book is 20 years old. maybe in 20 more years programmers will stop with the loving singletons/global state (yeah right)

double riveting
Jul 5, 2013

look at them go

Bloody posted:

is object oriented a design pattern? if so, that's the one i use

no dude, that's a paradigm. a way of living. an explanation of the universal nature. everything is an object! everything has methods! there are no functions! functions are objects! message passing.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Otto Skorzeny posted:

the actual problem with the strategy pattern is that it is trivial and not worth discussing (all gof patterns are either trivial inclusive-or dumb, and most of them are papering over flaws of early c++ and java rather than actual language-agnostic designs)

yeah but if you don't give the java crowd a cookbook of patterns most of them will just bash their dumb heads against any problem by writing a huge mountain of basic control flow operations

Nomnom Cookie
Aug 30, 2009



Wheany posted:

"slight performance penalty" always means either virtual function call or object instantiation

and then the example code uses variations of bubble sort to make its point

object instantiation is also fast as fuk on the jvm for simple objects. you can fill up the young gen with objects pdq and as long as they're garbage by the time the jvm does a young gen collection you can blow them all away lickety-split, too

modern java is faster than poo poo through a goose and u have to be pretty fuckin dumb to use anything lower-level unless you're doing realtime poo poo

Shaggar
Apr 26, 2006
Probation
Can't post for 5 hours!
java is ftw but im writing c# right now and its also ftw.

Nomnom Cookie
Aug 30, 2009



Tiny Bug Child posted:

yeah but if you don't give the java crowd a cookbook of patterns most of them will just bash their dumb heads against any problem by writing a huge mountain of basic control flow operations

i have a design problem. i should use a pattern. singleton is a pattern. therefore i'll use singleton

Bloody
Mar 3, 2013

i want to make a web app but i dont know anything involved. like html and javascript and css are all some idiot fucker thing as far as im concerned

i can do the important software bits but getting it into a browser in a way that doesnt look like hell is currently beyond me

i dont need crazy client-server bullshit, just posting poo poo around should be fine

there will be a database and i might actually not use an orm

where do i start

how do i do this

sned help

Nomnom Cookie
Aug 30, 2009



use bootstrap

Shaggar
Apr 26, 2006
Probation
Can't post for 5 hours!
use asp.net mvc4

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Nomnom Cookie posted:

i have a design problem. i should use a pattern. singleton is a pattern. therefore i'll use singleton

singletons own. my favorite design pattern is a variation of the singleton i invented myself, using the power of PHP. PHP lets you call static methods on instances, so what you do is make all your methods static so you can use the class like a singleton or instantiate it depending on what u want to do

Bloody
Mar 3, 2013

Nomnom Cookie posted:

use bootstrap


Shaggar posted:

use asp.net mvc4

got any decent guides for complete morons who go into it thinking they're smarter than they are?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Bloody posted:

i want to make a web app

power botton
Nov 2, 2011

Nomnom Cookie posted:

use bootstrap

this except zurb foundation or bourbon + neat

Nomnom Cookie
Aug 30, 2009



Tiny Bug Child posted:

singletons own. my favorite design pattern is a variation of the singleton i invented myself, using the power of PHP. PHP lets you call static methods on instances, so what you do is make all your methods static so you can use the class like a singleton or instantiate it depending on what u want to do

i know u can do better than that. you didn't even mention autoloading or eval

Shaggar
Apr 26, 2006
Probation
Can't post for 5 hours!

Bloody posted:

got any decent guides for complete morons who go into it thinking they're smarter than they are?

http://www.asp.net/mvc

Bloody
Mar 3, 2013

git clone trooper posted:

this except zurb foundation or bourbon + neat

if youre suggesting i do it while drunk then well duh thats a given

Bloody
Mar 3, 2013


actually gonna use this, thanks

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Bloody posted:

got any decent guides for complete morons who go into it thinking they're smarter than they are?

bootstrap's documentation kind of sucks. just look at their example page, find something that looks like what you want to do, and open up the inspector

also don't use bootstrap 3, because it succumbed to the "flat and ugly" design fad. the last good version of bootstrap is 2.3.2.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
i have to admit that i liked the exercises of this course, though. i don't remember exactly how they went but they were something like "make conway's game of life without using if, while, for or switch", "make conway's game of life without using else, using some limited number of variables per method, without using more than 1 level of indentation and without having more than some limited number of lines per method". the language was java

they were silly as hell, but they actually made me think of those problems differently

Bloody
Mar 3, 2013

Tiny Bug Child posted:

bootstrap's documentation kind of sucks. just look at their example page, find something that looks like what you want to do, and open up the inspector

also don't use bootstrap 3, because it succumbed to the "flat and ugly" design fad. the last good version of bootstrap is 2.3.2.

that could be a problem. i literally don't know how css and html work and havent dealt with either since loving around with dreamweaver a literal decade ago.

Bloody
Mar 3, 2013

Wheany posted:

i have to admit that i liked the exercises of this course, though. i don't remember exactly how they went but they were something like "make conway's game of life without using if, while, for or switch", "make conway's game of life without using else, using some limited number of variables per method, without using more than 1 level of indentation and without having more than some limited number of lines per method". the language was java

they were silly as hell, but they actually made me think of those problems differently

abuse ternary operators?

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Nomnom Cookie posted:

i know u can do better than that. you didn't even mention autoloading or eval

see you think i'm joking but i'm not. this pattern is completely perfect for database connections, where 95% of the time you only want one and you want it to be globally accessible. so 95% of your db calls look like

$butt_count = DB::get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

simple and easy. only one call to run one query. but then if you need to run a query against some other server or something you can go

$special_db_conn = new DB('slave.domain.com');
$butt_count = $special_db_conn->get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Bloody posted:

that could be a problem. i literally don't know how css and html work and havent dealt with either since loving around with dreamweaver a literal decade ago.

start typing things into this and see how they look on a browser:
HTML code:
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>title</title>
		<link rel="stylesheet" href="style.css">
		<script src="script.js"></script>
	</head>
	<body>
		<!-- page content -->
	</body>
</html>

Nomnom Cookie
Aug 30, 2009



Tiny Bug Child posted:

see you think i'm joking but i'm not. this pattern is completely perfect for database connections, where 95% of the time you only want one and you want it to be globally accessible. so 95% of your db calls look like

$butt_count = DB::get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

simple and easy. only one call to run one query. but then if you need to run a query against some other server or something you can go

$special_db_conn = new DB('slave.domain.com');
$butt_count = $special_db_conn->get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

im not joking either. it doesn't count as pro php unless theres autoloading and eval

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Bloody posted:

abuse ternary operators?

yes, you could do that, but i think that's cheating.

what you do is a shitload of classes with methods that do exactly one thing using some subclass of a thing as their argument and the return another subclass of that thing.

then chain those and let polymorphism do all the ifs and elses for you

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

php
bub

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

Nomnom Cookie posted:

im not joking either. it doesn't count as pro php unless theres autoloading and eval

idk what your beef with autoloading is because it's pretty basic to how php works. the alternative is manually including a list of class files. it's like saying code doesn't count as pro python unless it has stupid interpreter-enforced formatting.

that said i have never once come across a legitimate use for eval in php

double riveting
Jul 5, 2013

look at them go

Tiny Bug Child posted:

see you think i'm joking but i'm not. this pattern is completely perfect for database connections, where 95% of the time you only want one and you want it to be globally accessible. so 95% of your db calls look like

$butt_count = DB::get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

simple and easy. only one call to run one query. but then if you need to run a query against some other server or something you can go

$special_db_conn = new DB('slave.domain.com');
$butt_count = $special_db_conn->get("SELECT COUNT(*) FROM butts WHERE butt_owner_id=?", $butt_owner);

so prototype inheritance for php?

Bloody
Mar 3, 2013

Tiny Bug Child posted:

i have never once come across a legitimate use for php

Notorious b.s.d.
Jan 25, 2003

by Reene

Bloody posted:

that could be a problem. i literally don't know how css and html work and havent dealt with either since loving around with dreamweaver a literal decade ago.

just learn html, it only takes a couple of hours

then you can pay someone to do css and de-uglify it later

Notorious b.s.d.
Jan 25, 2003

by Reene

Tiny Bug Child posted:

see you think i'm joking but i'm not. this pattern is completely perfect for database connections, where 95% of the time you only want one and you want it to be globally accessible. so 95% of your db calls look like

i pretty much never want my database connections to be singular or globally accessible. i want a connection pool with a large number of connections, and my sessions should be carefully restricted in scope



kids, this is what php does to your brain. don't let it happen to you

Adbot
ADBOT LOVES YOU

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
that is definitely a Weird Edge Case tho. one global db conn is best for most applications

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply