|
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. 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)
|
# ? Sep 18, 2013 14:23 |
|
|
# ? Jun 2, 2024 20:34 |
|
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?
|
# ? Sep 18, 2013 14:41 |
|
mnd posted:Actual PL inquiry: has anyone here used Julia for anything (on Windows)? Does it run/install? use linux where it works trivially
|
# ? Sep 18, 2013 14:52 |
|
Brain Candy posted:and surprise, the performance analysis hasn't been updated since then either 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
|
# ? Sep 18, 2013 15:11 |
|
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...
|
# ? Sep 18, 2013 15:13 |
|
is object oriented a design pattern? if so, that's the one i use
|
# ? Sep 18, 2013 15:16 |
|
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
|
# ? Sep 18, 2013 15:18 |
|
"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
|
# ? Sep 18, 2013 15:20 |
|
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)
|
# ? Sep 18, 2013 15:21 |
|
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.
|
# ? Sep 18, 2013 15:21 |
|
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
|
# ? Sep 18, 2013 15:23 |
|
Wheany posted:"slight performance penalty" always means either virtual function call or object instantiation 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
|
# ? Sep 18, 2013 15:25 |
|
java is ftw but im writing c# right now and its also ftw.
|
# ? Sep 18, 2013 15:26 |
|
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
|
# ? Sep 18, 2013 15:27 |
|
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
|
# ? Sep 18, 2013 15:29 |
|
use bootstrap
|
# ? Sep 18, 2013 15:30 |
|
use asp.net mvc4
|
# ? Sep 18, 2013 15:31 |
|
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
|
# ? Sep 18, 2013 15:31 |
|
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?
|
# ? Sep 18, 2013 15:32 |
|
Bloody posted:i want to make a web app
|
# ? Sep 18, 2013 15:32 |
|
Nomnom Cookie posted:use bootstrap this except zurb foundation or bourbon + neat
|
# ? Sep 18, 2013 15:33 |
|
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
|
# ? Sep 18, 2013 15:33 |
|
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
|
# ? Sep 18, 2013 15:33 |
|
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
|
# ? Sep 18, 2013 15:33 |
|
actually gonna use this, thanks
|
# ? Sep 18, 2013 15:34 |
|
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.
|
# ? Sep 18, 2013 15:34 |
|
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
|
# ? Sep 18, 2013 15:34 |
|
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 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.
|
# ? Sep 18, 2013 15:36 |
|
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 abuse ternary operators?
|
# ? Sep 18, 2013 15:36 |
|
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);
|
# ? Sep 18, 2013 15:38 |
|
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:
|
# ? Sep 18, 2013 15:38 |
|
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 im not joking either. it doesn't count as pro php unless theres autoloading and eval
|
# ? Sep 18, 2013 15:40 |
|
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
|
# ? Sep 18, 2013 15:41 |
|
php bub
|
# ? Sep 18, 2013 15:42 |
|
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
|
# ? Sep 18, 2013 15:42 |
|
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 so prototype inheritance for php?
|
# ? Sep 18, 2013 16:04 |
|
Tiny Bug Child posted:i have never once come across a legitimate use for php
|
# ? Sep 18, 2013 16:18 |
|
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
|
# ? Sep 18, 2013 16:19 |
|
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
|
# ? Sep 18, 2013 16:20 |
|
|
# ? Jun 2, 2024 20:34 |
|
that is definitely a Weird Edge Case tho. one global db conn is best for most applications
|
# ? Sep 18, 2013 16:24 |