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
DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Snapchat A Titty posted:

i honestly dont know. in an ideal world i would transition to a normalized database, deprecating whatever was needed on the way. but idk what to do if youre locked on the schema and logging is out of the question

actually i have a lot of control and i've been told that i'm allowed to try and fix it so that's pretty cool.

logging is also not out of the question, i just don't really know how to go about it without instituting large architectural changes that would take a long time and require approval.

anyhow i'm actually really excited about it. it's my first actual big undertaking w/ lots of responsibility since i started at a real programming job and i have a bad case of the job cares so i'm into that kind of thing.

Adbot
ADBOT LOVES YOU

PokeJoe
Aug 24, 2004

hail cgatan


ughhh the lectures for harvards cs50x are full of memes

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

PokeJoe posted:

ughhh the lectures for harvards cs50x are full of memes

at harvard they're referred to as concentrations

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof
i've been working on eclipse plugins and i don't know which is worse, the byzantine di or the bottomless pit of abstraction layers

jfc

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



MALE SHOEGAZE posted:

actually i have a lot of control and i've been told that i'm allowed to try and fix it so that's pretty cool.

logging is also not out of the question, i just don't really know how to go about it without instituting large architectural changes that would take a long time and require approval.

anyhow i'm actually really excited about it. it's my first actual big undertaking w/ lots of responsibility since i started at a real programming job and i have a bad case of the job cares so i'm into that kind of thing.

ok thats pretty cool

i guess document the interface as good as possible, then figure out an optimal version of that, and work towards that. in an imaginary world you could even just build the final api and then rewrite the old api as a client of that, and then remove parts of the old one but thats a bit much

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
someone wrote git in javascript but it's actually pretty cool

http://gitlet.maryrosecook.com/docs/gitlet.html

Space Whale
Nov 6, 2014
I did data first ef before code first ef and code first seems dumb especially when you already have a database.

Why would you do codefirst.

more like dICK
Feb 15, 2010

This is inevitable.

DaTroof posted:

i've been working on eclipse plugins and i don't know which is worse, the byzantine di or the bottomless pit of abstraction layers

jfc

dehumanize yourself and face to OSGI

MeruFM
Jul 27, 2010

Space Whale posted:

I did data first ef before code first ef and code first seems dumb especially when you already have a database.

Why would you do codefirst.

what does code first even mean

somehow transform your objects into database tables?

Arcsech
Aug 5, 2008

MeruFM posted:

what does code first even mean

somehow transform your objects into database tables?

Yes

why bother designing your database when you can just write the same classes you would normally and have a Microsoft product magically turn it into a database, right?

Brave GNU World
Nov 1, 2013

by Cyrano4747

PokeJoe posted:

ughhh the lectures for harvards cs50x are full of memes

oh my god not memes, those are for idiot fuckers who use p-langs and don't have cattes.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Brave GNU World posted:

oh my god not memes, those are for idiot fuckers who use p-langs and don't have cattes.

mlyp

fritz
Jul 26, 2003

fritz posted:

i started getting mysterious segfaults when i link my code against lib.a but they go away when i link against lib.dylib, am i gonna have to figure out how Xcode works to get in and debug this b/c: don't wanna

i got pulled away from this before noon but i did discover that if i have a std::set<std::string> then .emplace("butt") works but .insert("cloud") leads to segfaults

i am the worst programmer

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



fritz posted:

i got pulled away from this before noon but i did discover that if i have a std::set<std::string> then .emplace("butt") works but .insert("cloud") leads to segfaults

i am the worst programmer

seriously i was trying to get a std::set<mytype> working today and i gave up, it is bullshit and nothing works like it should and gently caress it all

hobbesmaster
Jan 28, 2008

Snapchat A Titty posted:

seriously i was trying to get a std::set<mytype> working today and i gave up, it is bullshit and nothing works like it should and gently caress it all

1. does mytype have a copy constructor and assignment operator
2. did you give it a comparator
3. :suicide:

Shaggar
Apr 26, 2006

MALE SHOEGAZE posted:

so i have basically inherited a very large and very bad part of our code base. the db schema is entirely denormalized and there's almost no validation and everything is a poo poo gently caress. also basically every table has a yaml or json column and then those columns are eval'd and attribute accessors dynamically defined. and of course really important data ends up in there so have fun doing joins with regular expressions. anyhow the whole thing is held together by a boatload of workers that just run and run and run because if something breaks, chances are it's going to work again in a few hours when some random attribute on the other side of the database has changed.

anyhow, my question is, what's the best way to track state transformations in a web system like this? like, you know, I could intercept all database updates to the tables i'm worried about and stream them to bigquery or something but i have a feeling our dbas and network guys would not be very happy about that.

is there maybe just a simple logging strategy i can employ because logging has sucked so far. using logging to track the (month long) lifecycle of an object in a load balanced and multithreaded application is extremely frustrating

normalize the data and use stored procs

JewKiller 3000
Nov 28, 2006

by Lowtax
emplace() lmfao

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



hobbesmaster posted:

1. does mytype have a copy constructor and assignment operator
2. did you give it a comparator
3. :suicide:

i know what these things mean but i seriously dont care to make all those things do the whatever etc

hobbesmaster
Jan 28, 2008

yes that's why step 3 is there

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



gently caress sorry yeah that is exactly it

it didnt animate for some reason

Chill Callahan
Nov 14, 2012

Shaggar posted:

normalize the data and use stored procs

https://www.youtube.com/watch?v=P3ALwKeSEYs

Chill Callahan
Nov 14, 2012
use the ORM libraries as statement mappers

Chill Callahan
Nov 14, 2012
lazy loading is a cancer

tef
May 30, 2004

-> some l-system crap ->

MALE SHOEGAZE posted:

so i have basically inherited a very large and very bad part of our code base. the db schema is entirely denormalized and there's almost no validation and everything is a poo poo gently caress. also basically every table has a yaml or json column and then those columns are eval'd and attribute accessors dynamically defined. and of course really important data ends up in there so have fun doing joins with regular expressions. anyhow the whole thing is held together by a boatload of workers that just run and run and run because if something breaks, chances are it's going to work again in a few hours when some random attribute on the other side of the database has changed.

here is my generic advice on refactoring/rearchitecting existing production systems

the best thing i can think to do first is to document everything. not heavily, but about ~4 whiteboards worth of scribbles, showing how the parts interlink and mingle. you can't begin to change the structure until you know how the pieces interconnect. it'll take some mechanical sympathy too, being on call, debugging, and grinding through the code to be able to describe it fluently. there are some things everyone knows the code does and thus never talks or thinks about.

remember that the code you are seeing is a snapshot - a fixed point in the codebase's lifecycle. although you can read to understand how it works, you should read to understand how it got that way. things that seem unnecessarily divided are often caused by someone working outside of the team. there may be half refactored things, iterative steps the project took and were subsequently abandoned. from here, it gets a bit X-Y problem. you have the Y and you need to reverse engineer the X that got it that way. i have read enough code that i no longer go "wtf" so much: the code still smells i just have a better idea of what the person was attempting or trying to do in the first place.

once you understand the code, the problem space, and the history of both, you can start to push changes back through. it's a lot easier to design in hindsight—often the early versions of a codebase are still exploring the problem.

:words:

all i'm saying is, don't poo poo all over other peoples code (when you're new to a project).

quote:

anyhow, my question is, what's the best way to track state transformations in a web system like this? like, you know, I could intercept all database updates to the tables i'm worried about and stream them to bigquery or something but i have a feeling our dbas and network guys would not be very happy about that.

is there maybe just a simple logging strategy i can employ because logging has sucked so far. using logging to track the (month long) lifecycle of an object in a load balanced and multithreaded application is extremely frustrating

to justify that blargh of text above: knowing more about your architecture would make it more obvious how to approach logging

- does it make more sense to log everything or be able to trace one specific action through the system
- how long do you need the historical data for and what sort of queries will you write.
- how quickly do you need the historical data/logs

it kinda also depends on how your system sorta operates:

- is it a blackboard style system? you have a bunch of actors and a large mutable space
- or it is it more like msr's orleans? persistent actors with message passing
- what about a tuple space? could it be modeled as a disruptor like imax's
- is it more like bounded sequential processing? is it a batch system? streaming?

having a rough high level model will influence how you want to log things too. . it is useful to think up 'perfect' ways of solving a problem, if only to let yourself think about the code without contraining yourself too early, but also look for cheap hacks. i find it's often a combination of the two: a cheap hack that works, doesn't get in the way of doing it right in future, and although cheap, not too clever for its own good.

the easiest thing would be: log to syslogd, send logs to central server. alternatively log to a local file + run log rotation and collection. it also depends on the platforrm you deploy on and what sort of things you're layering on? hardware? aws? clouuud? there are other approaches like google's dapper/twitter's zipkin for tracing actions in a distributed system and you might be able to reuse some of the tooling twitter released. another approach is to just use the database. create a table, append entries to the table when things change, possibly as triggers. run regular cleanup operations/compaction.

shrug

edit: another thing might be to change the database stuff to avoid in-place changes and mutation: add a timestamp column. or it might be easier to stick logs and older versions of the yaml/json inside themselves, if that makes any sense. instead of logging out of band, smuggle it inside those json and yaml columns.

it might be a case of doing a little bit of all of these: each thread writes it's own log, and has a uuid and a timestamp. it logs all actions and changes made to the local disk/syslog equivilent. when it changes or creates a new object, it appends it's uuid and timestamp to a list inside the json/yaml document. from here you can take any document and reconstruct every operation by matching those uuid/timestamps to the logs.

shrug

tef fucked around with this message at 11:11 on Jan 24, 2015

Stringent
Dec 22, 2004


image text goes here

tef posted:

remember that the code you are seeing is a snapshot - a fixed point in the codebase's lifecycle. although you can read to understand how it works, you should read to understand how it got that way.

i've taken to adding a comment linking the issue that documents whatever obscure edge case necessitated the code i put in that looks like the code that a retard would write. the people that will come after will definitely just be like wtf and erase it causing a regression otherwise.

i know this sounds retardedly obvious, but no one ever does it.

Brain Candy
May 18, 2006

Stringent posted:

i've taken to adding a comment linking the issue that documents whatever obscure edge case necessitated the code i put in that looks like the code that a retard would write. the people that will come after will definitely just be like wtf and erase it causing a regression otherwise.

i know this sounds retardedly obvious, but no one ever does it.

all it takes is one actual retard go run around making 'fixes' for this to go back to worthless. even if you've miraculously eliminated all bad coders (and hangovers), after it gets touched again, how do i know what's for the bug and what's not?

imo, the only thing i trust is an explanation. it guarantees you engaged your brain even if i don't agree and i can match it quickly against the code that's actually there

also writing explanations for retarded code sometimes gives you a better idea

Asshole Masonanie
Oct 27, 2009

by vyelkin

Chill Callahan posted:

lazy loading is a cancer

my boss loves doing this

crazypenguin
Mar 9, 2005
nothing witty here, move along

DaTroof posted:

i've been working on eclipse plugins and i don't know which is worse, the byzantine di or the bottomless pit of abstraction layers

jfc

Welcome to hell! I don't think I can help, but let me tell you about some of the circles.

First you get to figure out OSGi. Then (to build outside of eclipse) there's maven and Tycho, which fucks with maven weird and has some really annoying behavior. Then there's digging through the mountains to find the correct bullshit for plugin.xml. Then there's the sea of interfaces with partial documentation. Then there's the loving mystifying design like IAdaptable which is just... I don't have the words.

Space Whale
Nov 6, 2014

Arcsech posted:

Yes

why bother designing your database when you can just write the same classes you would normally and have a Microsoft product magically turn it into a database, right?

A lovely DB already exists.

Instead of magicing that into classes and contexts and poo poo, we're recreating what's there manually.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

MALE SHOEGAZE posted:

wrote git in javascript

i've lived too long

tef
May 30, 2004

-> some l-system crap ->
i for one welcome our new es6 overlords

MeruFM
Jul 27, 2010
yield you good

ConanTheLibrarian
Aug 13, 2004


dis buch is late
Fallen Rib

comedyblissoption posted:

The OOP mania where everything must be an object and an object is the smallest unit of program composition has forced these insane programming styles and boilerplate.

Not to say that objects are a bad idea, but making them the smallest unit of program composition is a Bad Idea.

I came across a good distinction in some book that said that a program will have objects in the OO sense which should have all the fancy bells and whistles that implies, and also have things that are incidentally implemented as objects but which are just dumb little data holders and you shouldn't care about OO principles for them

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

tef posted:

here is my generic advice on refactoring/rearchitecting existing production systems


all i'm saying is, don't poo poo all over other peoples code (when you're new to a project).

thanks tef. i've actually been dealing with this code for about 6 months and i have a decent appreciation of how it got to where it is. i've mostly been doing documentation, bug fixes, and hacking in monkey patches ahead of API changes in services we deal with (also hacking in product changes).

anyhow i need to think about your questions so i will and then post them to this thread

tef
May 30, 2004

-> some l-system crap ->

MALE SHOEGAZE posted:

thanks tef. i've actually been dealing with this code for about 6 months and i have a decent appreciation of how it got to where it is. i've mostly been doing documentation, bug fixes, and hacking in monkey patches ahead of API changes in services we deal with (also hacking in product changes).

nice.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

crazypenguin posted:

Welcome to hell! I don't think I can help, but let me tell you about some of the circles.

First you get to figure out OSGi. Then (to build outside of eclipse) there's maven and Tycho, which fucks with maven weird and has some really annoying behavior. Then there's digging through the mountains to find the correct bullshit for plugin.xml. Then there's the sea of interfaces with partial documentation. Then there's the loving mystifying design like IAdaptable which is just... I don't have the words.

the interfaces never loving end. every time i think i'm at the center of the onion, i find another layer duct-taped to the other side of it. i spent weeks figuring out poo poo like document providers, partitioning, and source viewer configurations so i could build a custom editor, and then i tried to integrate with dltk, and it turned everything i knew on its ear

documentation? lmao, you can tell when i've been working on this plugin by counting the open tabs in my browser window. 90% of them are stackoverflow questions without useful answers

i haven't even touched maven and tycho yet except to import an existing plugin's project into eclipse

unsanitary
Dec 14, 2007

don't sweat the technique
you guys i'm 6 months into my first job as a developer out of school and i still write disgusting, horrible code. i'm still a pathetic programmer. my coworkers like me though. how long can i keep this up until they start to realize i'm a fraud

Shaggar
Apr 26, 2006
everyone knows recent grads are worthless until they've been retrained so don't worry about it

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

unsanitary posted:

you guys i'm 6 months into my first job as a developer out of school and i still write disgusting, horrible code. i'm still a pathetic programmer. my coworkers like me though. how long can i keep this up until they start to realize i'm a fraud

same boat (except i didnt do school). it's taken me about 6 months to realize i'm not a fraud so i dont know maybe you're screwed forever!!!

Adbot
ADBOT LOVES YOU

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

unsanitary posted:

you guys i'm 6 months into my first job as a developer out of school and i still write disgusting, horrible code. i'm still a pathetic programmer. my coworkers like me though. how long can i keep this up until they start to realize i'm a fraud

they like you because their code is even worse

  • Locked thread