« first day (4765 days earlier)      last day (408 days later) » 

02:17
the fact logging can tell you the function where it is being called from is a point in favour of breaking up functions into smaller ones. anyone have thoughts on long functions + commenting vs. short functions?
I have for instance this function that has three distinct parts that I don't think will ever be called separately
02:45
There is a mantra in XP that a comment is an apology for a missing refactoring. "Uncle" Bob Martin, for example, advocates very strongly for short functions (very short - shorter than you might think feasible, until you have some practice with it), and I have had great success with this technique.
A function is something that can be named, and a good name is executable documentation.
(well, an executable comment. most often these things are only part of a private API, at least initially)
@Peilonrayz people really expect too much of type annotations, IMO.
03:02
@KarlKnechtel woah that's a cool mantra, very enlightening commentary thanks!
03:49
suppose a database table undergoes a set number of changes during a period of a year. is it common place to make a new table each time a change is made, and begin making new entries into this new table, instead of modifying the previously existing table?
 
4 hours later…
07:26
@shintuku no, it's very much not common practice. You'll typically break tonnes of code. This is why people care about "database normalisation" to make the design extensible as possible from the start (knowing that things will change) and you can track changes to schema in much the same way as code with git using something like Alembic
@KarlKnechtel there are so many rebuttals against Clean Code... we had a similar debate about it in this room not long ago
07:53
Oct 19 at 13:13, by PM 2Ring
@Arne It's probably worse than LPTHW. "Uncle Bob" Martin is a very prominent software engineer, associated with the Agile manifesto, and SOLID design principles. https://en.wikipedia.org/wiki/Robert_C._Martin Clean Code is pretty famous, even outside Java circles. But as that qntm critique points out, it's riddled with flaws & inconsistencies.
Referencing:
Oct 19 at 11:35, by Arne
I found a critique of the Clean Code that I'd enjoyed in the past: https://qntm.org/clean
Yes, def now_do_the_next_step(self): self.foo = bar is just pointless indirection. The X in XP stands for extreme and unsurprisingly all sort of fundamentalist zeal is harmful, especially in Python.
Make your code readable.
@Aran-Fey does it help if you completely separate the data from the GUI with something like an MVC pattern, where there's a controller who's aware of both data and GUI?
08:17
Tbh I don't really understand that pattern, but I don't think so? As far as I can tell, I still have the same problem when it comes to implementing the View: How do I know that a Healer needs 1 input element and a Tank needs 2?
Counter-tbh I didn't quite understand the issue :P
Either the gui is aware of the data structures in detail or there's a well-defined config somewhere
In MVC the controller could tell the gui how to populate dynamic widgets based on the data, I think
So the GUI would only have a "create input element with this label" method
Basically the problem is that my code is generally designed for "static" access, like character = Healer(); character.mana = 5, but sometimes (like in the case of a GUI) you need "dynamic" access like for every playable class and for every stat in this class
Yeah, if you don't want to getattr you should switch to a mapping-like interface. Not sure there's any way around that.
Rereading the question I'm still unsure :D
13 hours ago, by Aran-Fey
My problem is that this is super specifically designed for the GUI and not at all how you'd usually expect it to be implemented. Usually you'd imagine something like character.mana = 5, right? If I hadn't known about the GUI in advance, I would've implemented it completely differently. That doesn't sit right with me. Am I doing something wrong here or do you really just have to know in advance?
character.stats['mana'] = 5 seems general enough
And doing that with an input-like-thing also makes sense. So I still don't get it I think.
Yeah, stats could be implemented as a mapping. I'm not sure how I'd make the classes iterable, though. Maybe something like class Class(Enum): HEALER = ['mana']?
Then I could do for cls in Class: for stat in cls.value: make_gui_element() in the GUI
08:35
I don't understand why you need your class to be iterable.
Say I want to make a dropdown that lists every playable class
Abstract parent class?
Potentially with an empty body
Enum is probably close
An abstract class requires at least one abstract method, and I'm not sure what that would be
Is that enforced?
Even if yes, make it "_abstract" and shrug
(Private instead of abstract)
Why can't you: define a tuple on the class as a classvar, or have a mapping of the type to the tuple (dict[Types, tuple[str, ...]])?
08:40
Make __init__() abstract :D
I guess it doesn't really matter if it's abstract, as long as there's a shared parent class I can list all of the playable classes with BaseClass.__subclasses__()
Yup
Only needs to be abstract to prevent instantiation by suicidal footgun wielders
Semantically abstract
A potential problem would be if there are "intermediate" classes, like if Priest and Paladin both inherit from Healer
Isn't there some kind of design/architecture/guideline that tells me how to translate my thoughts/goals (like "Healer is a playable class", or "Healer has the stat Mana", etc) into code so I don't have to plan all of this stuff in advance?
Or resort to metaprogramming with getattr/setattr/.__subclasses__()/...
Infinite mixin classes?
Still dunder subclasses though
I can imagine alternatively a global config you register types to with a decorator, but I'm not sure that's better
I suspect separate simple container implementedClasses is not a valid option?
08:47
@playable
@has_mana
class Healer:
    ...
Or @has_stats('mana')
@Peilonrayz I don't like the idea of a Mapping[CharacterClass, Tuple[Stat]] because it kind of "fragments" the code. Whenever I add a new CharacterClass, I have to remember to update this dict
Or class Healer(Class, stats=('mana',))
Would that be type safe? If I tried to do healer.defense = 5 or healer.stats['defense'] = 5 or whatever, would my IDE warn me?
I guess you could do something like class Healer(Class[Literal['mana']]), but then you have to list all of the stats in one place. It wouldn't let me express a concept of "Priest and Paladin are both Healers, so they both have mana)
This is why I always find it funny when beginners try to write a game
08:56
still sounds like subclassing with recursive subclass search
Yeah, I think getattr/setattr/__subclasses__() is the way to go
09:15
@shintuku FWIW, logging's smaller cousin warning ships with a parameter to say how many levels up the stack it should look for the function name. Having too localized information isn't helpful either.
@Aran-Fey Can you invert the relation? So instead of the UI mucking in the character data, the character data requests values from the UI.
I would still need a way to iterate over all the relevant stats for the character though, right?
09:58
Yes, though you could define that in the character itself.
Right, but I'd have to know in advance, otherwise I'd just write self.mana = 0 and then there wouldn't be an obvious/easy way to loop over the stats. So how can I avoid the need to plan ahead?
I think it would be fair to say that self.mana = 0 is just... wrong. I have expressed "Healer has mana", but I have failed to express that "characters have stats" and "mana is a stat". So really it should be something like self.stats.mana = 0 instead
That's what I'm looking for, simple rules for how I should translate my mental model/goals into code
10:23
I didn't realise the extent to which I could be patronised until getting an hour into this onboarding from HR. I'd rather be eating my own face right now :'(
At least I get to choose the colour of my post-it notes on the jamboard. They haven't yet completely crushed my independence. They chose my spirit animal as my icon, though
@roganjosh what happened? Starting out and already getting patronised? How, why?
It's just stupid happy-clappy HR activities. We had an exercise where we had to divvy up our group into roles in making a pizza. Then a 10 minute discussion afterwards about "and what do you think would have happened if you tried to assign people to these roles without getting to know each other first?" and then to everyone's response "yeah... yeah, that's a really good point, isn't it? How could we know without asking first?"
It's like being in primary school
Well, as long as I'm getting paid :P
@roganjosh sounds like facilitators
Maybe. It's not like I've not gone through these before but this one is next-level infantilization
10:47
@roganjosh what's your spirit animal? :o
11:00
I couldn't work it out on account of doing the absolute minimum to get beyond the current hell and move on to the next. All I know is that she apologised beforehand if I was unhappy with it
Was there actual pizza involved?
I feel like it would be more bearable with actual pizza.
11:21
Well, if they happy-clappy did assign proper pizza-making roles, they sure managed to make a pizza.
The closest I came to caring was that my team assigned me an inappropriate role. Sourcing the ingredients was entirely in my wheelhouse given a career in logistics, but apparently I was better at preparing the ingredients. Then I realised that means I would have to participate to disagree and my life might be better spent rambling about the whole thing here
I don't know whether I should feel bad that there are 17 other people in this intro that actually take it seriously. Maybe I'm the weirdo
"all other 17 people seem to be enjoying this BS, am I just weird?" - all 18 participants, minus the HR folks
Then again, their company mission is "be no. 2 in the market" as they don't think they can catch number 1. I actually did contracting for no. 1 and by the second week I was in the War Room with a Director threatening to sack everyone if the project didn't work. I wasn't discussing how to make pizza. So perhaps no. 2 is a valid goal
(Although I was a contractor there, so pleasantries are hardly extended)
11:57
Man, now I REEEEALLY want to know which company 1 and 2 are :D
If only... internet
I dream of the day where gpt works they way I would like to use it :P
Basically take issue reports and output the needed code :D
12:27
Well, now that fun is over, I need to put together a presentation about packaging python projects for tomorrow. I'm thinking the old-style like I used here, the newer pyproject.toml approach and maybe touch on poetry. That should be enough scope for people that haven't packaged anything in the past or do I need more?
12:45
I'd omit the old style unless you know they're going to need it
My thinking is more about understanding existing packages or do you think it's truly obsolete now in the wid?
I agree that it already paints a confusing picture, I'm just trying to balance that against what they might find elsewhere
There's still a lot of setup.py stuff around. All the package compiler backends lag(ged ?) behind quite a lot for switching to toml.
Might want to check out what the PyPA has to say.
Oh, if they're gonna be looking at a lot of other people's code then it's a different story
13:36
@roganjosh I haven't read the book. rather, I've applied the principles as I understood them, via sources like the c2.com wiki way back in the day
@AndrasDeak--СлаваУкраїні this comes across as a misrepresentation
Sure, sorry
dropping in with praises of extreme programming in a context where newbies are around puts the onus on you to make a valid and clear point
I didn't think I did that, though?
this room is a context where newbies are around
I mean, I don't think I "dropped in with praises of XP"
because in my mind, XP is only the (very old) original statement of an idea that was iterated quite a bit over the years
Don't know about shintuku's expertise specifically
@KarlKnechtel ah.
Perhaps I've misread.
13:51
and people like Martin and Fowler didn't exactly just give up after getting their initial ideas out there
(or even Cunningham probably)
I think you'd find the critique that Arne posted an interesting read. Throughout the book, he consistently breaks his own rules and some of the code is borderline unintelligible. Perhaps your interpretation of his general thesis works well, but his own implementation is actually... lacking
14:14
I mean, I constantly feel like I did things wrong when I look at my old code; and many refactorings in Fowler's catalog are intentionally reversible because which way is better will be context dependent or even a matter of style
There's plenty of general things to take away from XP but in moderation (which is the difference between writing good code and doing XP).
Moderate programming, anyone? :P
morning cabbages folks. It's been a while... all potato?
Indeed it has been a while, how have you been?
14:29
oh man! work's been crazy. I've lost track of time, so here's a brief, cumulative update: Grandparents were ill in January - I took them to India. Grandpa passed away in May. Since i returned from India (mid Feb), I've been dealing with their affairs here (while also keeping up at work). Huge stressors. Took small pockets of mental health time. Looking to move apartments now. crashing at a friend's place while I figure things out
Went to Ireland for a beat and played my harmonica with a busker dressed a leprechaun. Attrition on the team, so more work on my plate now. Projects ramping up, so even more work upcoming. Building a few new systems at work... so lots of planning, coordination, and sequestering/prioritization
EOF
Well that definitely sounds busy, I'm sorry for your loss. It's good that you have a friend's house to stay at to give you some time to take stock of your situation
many thanks. I'm glad to have such good friends, also. Anyhoo... how've you been? I've missed r/6
I'm also lucky to not have been impacted by the industry's current layoff trend. That's wild!
I did some contracting which ended, so I got a few months to pretend that I don't have to work again. I finally managed to make it to Japan with my best friend, which ticked off a major bucket list item, now I'm landed back on Earth back in the joys of corporate work
sweet! did you bring back any interesting toys?
14:44
No toys, no. I went a bit mad in Kyoto and bought a woodblock print from 1863, but it does look good framed. We also went to the Anime museum and got a portrait of myself, my friend and someone we befriended over there which is ace
that's pretty epic! Sounds like you had an awesome time :)
Had to make up for 5 years of no holidays, so do it in style :)
well done
 
1 hour later…
15:57
I suppose droplets do not come w web servers installed...I must install one
and in general i must install whatever necessary for my django app
There's a reason I keep calling them a "box". It's just a bare-metal linux machine
it's the first time a deploy something...forgive my naiveness
No need to apologise :)
What this means is that you will need to set up all the security for yourself too. So you'll want to get a firewall in place for a start
in fact I chose in the beginning 512Mb droplet only to realize that is not enough even for a MySQL server
yeah...correct to point out
@DimitrisPapageorgiou This is all part of the fun. Wait until you get to the end and want to attach a domain to your IP through the DNS. I've done it once and did it right the first time... but you have to wait 24 hours to find out if each iteration works and I have no idea if I went back to do it again whether I'd remember anything about it
Welp, I definitely don't know how I did it since apparently I never did. Great.
16:16
that part about being fun...you can say that again
16:42
@AndrasDeak--СлаваУкраїні I think of it as "seriously, try harder than that" programming
16:55
stackoverflow.com/questions/77411490 There's a duplicate for this right????
ok, stackoverflow.com/questions/8475290 was way too hard to find
 
3 hours later…
19:47
@inspectorG4dget Sorry for your loss.
@smci thanks mate :)
@roganjosh Well what do you think the onboarding should be for #3 or #5 company? Making pictures with macaroni and drool?
I expect that I knew more than enough before this session to do my job. I want the problem, the desired goal and then yam-off while I go fix that. Not someone coming up with every way of saying "that's great. Well done you" to every suggestion in a group exercise about making pizza
Fun fact; the only module in Uni that I nearly failed was "Professional Skills". I got 42%.
Though I did only attend half a lecture for the whole semester and I had the opportunity to leave that one. I also ditched their broken software for making P&ID diagrams and did it in Microsoft paint. Kinda deserved my score. But I had to leave before I boiled over
And the fake laughter from the host. Stahp.
20:20
Your question is here @AnilSarode
Please note the room rules particularly in regards to posting big blocks of code.
@roganjosh sorry for long post and thanks for your help.
No worries. We (the room owners) have been a bit lax in enforcing the policy so I'm trying to find the easiest way to transition back to enforcing the rule
Can you be more clear on what you think is wrong with the output?
The result for gradient descent i.e. manual implementation result does not match with the result obtained by standard Scikit-Learn's LinearRegression library for coefficient.
 
3 hours later…
23:13
@roganjosh Thanks for the comment and the reference to Alambic!

« first day (4765 days earlier)      last day (408 days later) »