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.
 
  • Locked thread
Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
I have this same problem too and what really helps is getting out a pencil and paper and drawing (the minimal) system

You'll start out really abstract and with iterative re-drawing you should start to get a feeling of how the boxes should be broken apart into sub-boxes and with experience you should be able to get an idea of how they should be coded.

It's not unreasonable to spend several hours doing this until you get your head in the right place imo

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008

jony neuemonic posted:

e/n incoming :toot:

how do i get better at greenfield development? i think i'm pretty good at working with existing stuff and i haven't had much trouble walking into some pretty gnarly projects and getting a handle on things, but whenever i get asked to build something from scratch i panic and deliver (imo) pretty bad work. it's real demoralizing because i don't want to do bad work, and it makes what should be a good opportunity (no more legacy code!) into a huge source of stress.

i get this - especially if you're in a larger company where a lot of the work is extension and addition. some tips

* think backwards. who's the customer of this? what do they actually want? Once you have an idea of what they want, you can start figuring out how to get them it
* Come up with the set of constraints you're working under. Try and really pick the constraints that have to absolutely be fulfilled
* Talk to your coworkers about your idea. Rubber ducking helps but getting a fresh pair of brain hemispheres helps more
* Be conservative. Assume that your group is going to have to own this, and that every new concept you bring in is yet more cognitive load. The clearest example of this is bringing in a new language that nothing else uses or knows.
* Write out a design. Take notes, do some prototyping, come up with your data model and interactions. Write up a design doc that hits these
  1. What is this all for? Often times you know how exactly what you mean when you say "Frothing Bit Reaper" but unsuprisingly a lot of your peers won't. Explaining what this is and why we're doing this is important for context
  2. Remember those constraints from that other bullet? Add these in too. Without those, someone reading your doc will think you're making the wrong decision because they lack the context of the constraints you're operating under.
  3. Go into medium-level detail. Be specific enough that you could hand the doc off to someone else to code it up, but general enough that you haven't literally done all the work

It turns out that "measure twice, cut once" is very applicable to software development, and having a document on hand that explains the what, why, and how of the project is really helpful for the actual implementation of said project

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

quiggy posted:

no templates

¯\_(ツ)_/¯

quiggy posted:

dynamic_casting Action pointers to learn their types, but that's too slow

one, I'd be careful of what you ask for as I doubt full reflection (and boxing/unboxing values) would be faster than dynamic_cast, two, you could look into typeid as an alternative, and three you've basically done everything that can be done. I doubt even post-c++03 could help you in any way

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

quiggy posted:

boy c++ it sure would be nice if you had literally any reflection at all

no see according to stroustrup such things are unproven and if they can't be done in a way that adds no overhead whatsoever for code that doesn't actively use it then they shouldn't be part of his language

while in the audience at the Q&A where he said that—about both reflection and dynamic linkage standards—I did some measurement; ObjC2's metadata only adds about 10-15% to binary size, most of which (other than selectors) isn't paged in until used

eschaton fucked around with this message at 02:29 on Oct 7, 2017

Luigi Thirty
Apr 30, 2006

Emergency confection port.

i miss the amiga library's wacky linked list inheritance inheritance scheme on the jaguar

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

eschaton posted:

no see according to stroustrup such things are unproven and if they can't be done in a way that adds no overhead whatsoever for code that doesn't actively use it then they shouldn't be part of his language

while in the audience at the Q&A where he said that—about both reflection and dynamic linkage standards—I did some measurement; ObjC2's metadata only adds about 10-15% to binary size, most of which (other than selectors) isn't paged in until used

yes, and meanwhile apple recommends switching to Swift, which doesn't have the dynamic dispatch overhead or the process startup delay

jony neuemonic
Nov 13, 2009

thanks for the advice, all. this thread rules.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
let c++ be c++. if you want to use objective c instead of c++ (or together with it, like with objective c++), do it, what's stopping you except a trillion practical issues

tef
May 30, 2004

-> some l-system crap ->

jony neuemonic posted:

e/n incoming :toot:

how do i get better at greenfield development?

practice

it's mostly about avoiding the pitfalls than getting things right first time

the worst code is always an extensible mess, that requires changing things all over the code base, to support some need that never materialised


quote:

i think i'm pretty good at working with existing stuff and i haven't had much trouble walking into some pretty gnarly projects and getting a handle on things, but whenever i get asked to build something from scratch i panic and deliver (imo) pretty bad work.

welcome to the other end of the sewer

quote:

it's real demoralizing because i don't want to do bad work, and it makes what should be a good opportunity (no more legacy code!) into a huge source of stress.

bad code gets fixed, good code rots, but lovely code lasts forever

tef
May 30, 2004

-> some l-system crap ->
the best advice i could give would end up rephrasing this effort post i made in this or the other thread, ages ago

http://programmingisterrible.com/post/139222674273/write-code-that-is-easy-to-delete-not-easy-to

but really, it's still the same old stuff i keep banging on about

Arcsech
Aug 5, 2008
oh my god there's an open source java library that adds await for completeablefutures

and it's from electronic arts of all people??? https://github.com/electronicarts/ea-async

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Luigi Thirty posted:

i miss the amiga library's wacky linked list inheritance inheritance scheme on the jaguar

implement your own version of it, you know you want to, and people totally do that sort of thing

my friend wrote most of a SEGA Genesis game that never shipped using Apple's "OO assembly" macros that were mainly intended to provide interoperability between high-performance assembly code and MacApp application-layer code written in Object Pascal

and I wrote most of an Objective-C runtime for 68K and PowerPC on the classic Mac OS when CodeWarrior added ObjC support to their compilers way before Mac OS X was ever released

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
speaking of the forums…

maybe I should restart my little project to write an NNTP server in Common Lisp

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
if dynamic cast would be optimal but it isn't efficient enough you can very easily hack up your own dynamic cast based on either virtual calls or (probably better) information you store in the base class. if your boss is dead-set against templates, well, be thankful that you only have four cases to support. something like

C++ code:
class Action {
  enum ValueKind { VK_String, VK_Int, ... };
  const ValueKind kind;
  Action(ValueKind kind) : kind(kind) {}
  IntAction *getAsIntAction();
  ...
};

this is basically what we do pervasively in llvm/clang/swift where we care a lot about casting and generally don't want to pay for v-tables

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
contributing to the ghost post war

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
ah I get it, ghost posts break the offset feature of Awful.app (where it only loads the new posts)

cinci zoo sniper
Mar 15, 2013




Maluco Marinero posted:

ah I get it, ghost posts break the offset feature of Awful.app (where it only loads the new posts)

initially we had last unread post being show as read. then thread began pointing to non-existent post at n+1, causing page load issues on the last post of the page since it then points at a thread that does not exist

redleader
Aug 18, 2005

Engage according to operational parameters
the terrible programmer thread is a very appropriate place for n+1 errors

quiggy
Aug 7, 2010

[in Russian] Oof.


rjmccall posted:

if dynamic cast would be optimal but it isn't efficient enough you can very easily hack up your own dynamic cast based on either virtual calls or (probably better) information you store in the base class. if your boss is dead-set against templates, well, be thankful that you only have four cases to support. something like

C++ code:
class Action {
  enum ValueKind { VK_String, VK_Int, ... };
  const ValueKind kind;
  Action(ValueKind kind) : kind(kind) {}
  IntAction *getAsIntAction();
  ...
};
this is basically what we do pervasively in llvm/clang/swift where we care a lot about casting and generally don't want to pay for v-tables

i thought about doing it this way as well, and may end up switching over to it if i ever learn that there's more cases i need to support

CPColin
Sep 9, 2003

Big ol' smile.

redleader posted:

the terrible programmer thread is a very appropriate place for n+1 errors

Also a good place for multiple, sightly different implementations of the same post!

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
[quote="“CPColin”" post="“477145304”"]
Also a good place for multiple, sightly different implementations of the same post!
[/quote]

but i thought golang was unpopular here

cinci zoo sniper
Mar 15, 2013




if my calculations are right, there will be a 13 post window opening in microsoft thread after 3 more posts

Chalks
Sep 30, 2009

We need YOU to shitpost the microsoft thread back to life.

*edit* and also this one

Chalks fucked around with this message at 19:34 on Oct 7, 2017

Sapozhnik
Jan 2, 2005

Nap Ghost
TIL that

Java code:
class GenericSomething<T extends Foo & Bar> {
	// ...
}
was a thing you could do in Java. The leftmost thing in the chain of ampersands must be the only class though (naturally...)

that would have been good to know before I went and twisted myself into pretzels trying to get some generics to work the way I wanted them to.

Sapozhnik fucked around with this message at 20:54 on Oct 7, 2017

Luigi Thirty
Apr 30, 2006

Emergency confection port.

eschaton posted:

implement your own version of it, you know you want to, and people totally do that sort of thing

my friend wrote most of a SEGA Genesis game that never shipped using Apple's "OO assembly" macros that were mainly intended to provide interoperability between high-performance assembly code and MacApp application-layer code written in Object Pascal

and I wrote most of an Objective-C runtime for 68K and PowerPC on the classic Mac OS when CodeWarrior added ObjC support to their compilers way before Mac OS X was ever released

sounds good to me, time to do some 68K magic

code:
void NewList(struct List *list)
{
	//An empty list loops back on itself.
	list->lh_Head = (struct Node *)((long)list + 4);
	list->lh_Tail = NULL;
	list->lh_TailPred = (struct Node *)((long)list);
}
i think the amiga includes files even include assembly macro versions of all the list operation functions

e: oh cool it does

pre:
AmigaList is at 0x74960
head node is at 0x749a0
head->ln_Succ is at 0x74a00
head node's name is Node1
head->ln_Succ node's name is Node2
head->ln_Succ->ln_Succ node's name is Node3
tail node's name is Node3
hell yeah i got it working enough to append to the head and tail of the list

Luigi Thirty fucked around with this message at 05:25 on Oct 8, 2017

Colonel Taint
Mar 14, 2004


Serendipity has made it official. I'm done with my task at hand

I've been working on refactoring the build system at work. It was pretty poo poo a few weeks ago - coders had to `make clean` before every build. Gradually I improved it, and a few days ago I thought it done, but not feeling satisfied I pressed on, inventing and testing new ways of improving the system. Things that nobody will probably ever use or appreciate, but damnit those things mattered, because the less you have to gently caress with Makefiles the better. Thus I toiled throughout the nights and weekend days, determined to leave the system at nothing less than optimal.

Well just a few mere minutes ago I believe I reached that point was nothing could be thought of to to add or remove. Now I usually like to let my playlist run on shuffle while I work. As I made my final mass sed replacement, a soothing crescendo of synthetic horns - unrecognized to me but nonetheless pleasant - made its way through my speakers. A few moments of reviewing the effects of the sed command, I was ready to test those final changes. No sooner had I entered 'bash test_make_all.sh' into my shell and the familiar spewing of the compiler commands begun scrolling through the console than those soothing horns led into - I poo poo you not - the unmistakable opening chords from the loving theme of loving chariots of fire.. So I watched in awe as over 20 different `make -j sometarget &` processes simultaneously spewed their outputs to the console and wept a tear of joy and danced a giddy dance as serendipity of the moment overwhelmed my soul with the purest joy.

Gentlemen, I'm done.

:suicide:

Sapozhnik
Jan 2, 2005

Nap Ghost
cool now port the build to meson and groan at how much time you could have saved

Sapozhnik
Jan 2, 2005

Nap Ghost
Still undecided on typescript vs flow for this reactjs side-project. I rather wish this rift didn't exist tbh

Flow:
- Written by a bunch of guys who love javascript so much they wrote a type checker for it in ocaml.
- poo poo performance under windows. Supposedly.
- The main IDE is Atom. What the gently caress even is Atom. How do I do anything beyond notepad.exe's capabilities with this goddamn bullshit.
- Yeah you can kind of use it from VSCode but the integration is third-party and really crappy and you have to rip out half of VSCode to make it work so wtf is the point.
- I erroneously wrote "import type * as types from 'whatever'" and this sent it into a crash loop. One crash loop per CPU core, as a matter of fact.
- There are already two incompatible versions in wide use.
- Facebook's whole dev tooling landscape in general is really vertically integrated and keeps wanting to drag in other poo poo of theirs.
+ Works with create-react-app out of the box (misnomer: this is a canned build system for react projects with sane defaults).
+ Facebook is stuck with this poo poo so they have to keep React and Immutable and all their other crap sort-of working with it.
+ Supposedly a stronger type system, and was in fact developed in response to perceived weaknesses in the design and objectives of TS.

TypeScript:
- Not a first-party solution: poo poo will break and I have to hope that people will be entertained by the process of fixing it.
- Don't know the details but the type system has impedance mismatches with Redux and Immutable.js. See above.
- Supposedly has a weaker type system than Flow.
+ I can edit it from VSCode and VSCode doesn't make me want to punch somebody
+ Has first-party support from redux-saga.
+ Has wider first-party support in general. Like there's a Protobuf library that emits TypeScript stubs, no such luck for Flow.

Honestly my main problem with Flow is that I really hate Atom from what little I've seen of it.

cinci zoo sniper
Mar 15, 2013




atom is basically like significantly slower, worse visual studio code. they recently shat an "ide" addon out through the door but it's still hot garbage clown bait

cinci zoo sniper
Mar 15, 2013




imo i'd go with typescript unless type system impedance mismatches are going to wreck the ball hard or you really can't get flow in something adequate (say, webstorm)

Notorious b.s.d.
Jan 25, 2003

by Reene

cinci zoo sniper posted:

atom is basically like significantly slower, worse visual studio code. they recently shat an "ide" addon out through the door but it's still hot garbage clown bait

how long is it gonna take y'all to learn emacs is the one true path

cinci zoo sniper
Mar 15, 2013




Notorious b.s.d. posted:

how long is it gonna take y'all to learn emacs is the one true path
never, or even longer if you are the voice

cinci zoo sniper
Mar 15, 2013




"computer programming tooling was solved in 1754 by otto von bismark XVIII" - notorious bsd

Sapozhnik
Jan 2, 2005

Nap Ghost

Notorious b.s.d. posted:

how long is it gonna take y'all to learn emacs is the one true path

elisp is poo poo and vimscript is double dog hypershit. atom is unironically a potentially better editor than both emacs and vim because it's built on top of javascript. yes, javascript is bad, but enough developers are stuck in this loveless marriage that the developer community is forced to somehow make javascript itself work.

modern editors are a text entry widget bolted on to a programming language, in much the same way that an A10 is an enormous gun that somebody mounted a plane onto. the choice of underlying language is crucial.

Gul Banana
Nov 28, 2003

typescript is better, but what would be much better is if one group would just give up. we don't need two type-definition-annotation languages for javascript

mystes
May 31, 2006

Gul Banana posted:

typescript is better, but what would be much better is if one group would just give up. we don't need two type-definition-annotation languages for javascript
Facebook is a company that just relicensed their software that has nothing to do with their business and that they were giving away for free, after adamantly insisting that they would never do so, just because the idea that some people on the internet who generate no money for Facebook might stop using it bruised their ego as elite programmers. I'm sure the announcement that they're deprecating Flow in favor of TypeScript will come any minute now.

(They also have a pointless different fork of Ocaml that appears to exist purely due to bikeshedding and NIH syndrome.)

mystes fucked around with this message at 18:16 on Oct 8, 2017

Sapozhnik
Jan 2, 2005

Nap Ghost

mystes posted:

(They also have a pointless different fork of Ocaml that appears to exist purely due to bikeshedding and NIH syndrome.)

jfc lol




oh, something else:

typescript files have a .ts extension instead of .js, as you'd expect
flow files have a // @flow line instead

reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

akadajet
Sep 14, 2003

both flow and typescript are completely unnecessary. just use babel and write javascript

mystes
May 31, 2006

akadajet posted:

both flow and typescript are completely unnecessary. just use babel and write javascript
If your reason for using typescript is that you need an es.next to es5 transpiler, then yes typescript is probably unnecessary.

Adbot
ADBOT LOVES YOU

Shaggar
Apr 26, 2006
if you are writing so much javascript that you need typescript to fix it, you're writing too much javascript. your javascript should really end at form validation and even that should just be the one line that adds the unobtrusive validator.

  • Locked thread