|
Arrow notation is the opposite of a coding horror.
|
# ? Aug 31, 2017 23:53 |
|
|
# ? Jun 7, 2024 17:06 |
|
chutwig posted:What are you people doing with Git that makes you feel like you need an army of shell scripts to manage it? Nearly all of my Git usage can be distilled down to 10 commands: I work on some projects in CVS; I'd have to ask what people _think_ they are doing in git that's so much more impossibly difficultingly world-ending in CVS. I just watched an intern get all excited about branching in git, until two weeks later when it took him three hours to figure out how to patch and code review his branches for release, because half the stuff was strewn on that side, and half on the other. I've seen a lot of production teams convince themselves "there should only be mainline with continuous deployment and continuous integration testing", at which point a project wouldn't even need functionality beyond that afforded by the most basic CVS commands. All the git reflog history rewriting carap, yeah I've only ever worked where git repositories permit no rewriting of history; once you push, it's recorded for all to see. So here it is, basically all I ever use to manage tasks in the CVS projects, and how they line up against git. I'll say this, I have to look up the syntax every single time I try to branch in git (I mean a real branch, in the repository). I was going to leave off the tool name so you'd be unbiased, but if you know one or the other you'll recognize the commands anyway. Note the clever flags on both sides, and the not-so-clever flags on both sides. I guess git didn't learn. code:
|
# ? Aug 31, 2017 23:59 |
|
Python's "self" operator is the real coding horror.
|
# ? Sep 1, 2017 00:01 |
|
Remind me how you break a lock with git?
|
# ? Sep 1, 2017 00:04 |
|
ratbert90 posted:Python's "self" operator is the real coding horror. It doesn't have an operator, it just explicitly passes the object as the first parameter in method calls and by (almost universal) convention that's called self.
|
# ? Sep 1, 2017 00:07 |
|
I'm really having a hard time understanding why they decided to use this awkward looking thunk or even suggest it rather than just provide a fake implementation. What am I missing here? It surely must be easier to test middleware in JavaScript.
|
# ? Sep 1, 2017 00:11 |
|
vOv posted:It doesn't have an operator, it just explicitly passes the object as the first parameter in method calls and by (almost universal) convention that's called self. Fine, but it's still stupid and bad.
|
# ? Sep 1, 2017 00:12 |
ratbert90 posted:Python's "self" operator is the real coding horror. I agree, but only because it's not a real keyword that's enforced by the interpreter. They should go all the way or not at all.
|
|
# ? Sep 1, 2017 00:22 |
|
ratbert90 posted:Fine, but it's still stupid and bad. How do you feel about "this" in languages like Java?
|
# ? Sep 1, 2017 01:13 |
|
ratbert90 posted:Fine, but it's still stupid and bad. I like it; it helps reinforce how object methods work. Python in general gives you a lot of access to the underlying constructs of the language. Of course, you shouldn't actually use that access in the vast majority of circumstances, but e.g. being able to monkey-patch in a stub so your unit tests can have a limited scope is pretty handy.
|
# ? Sep 1, 2017 03:18 |
|
self is preferential to an implicit this, but it is obnoxious how it makes the method's definition signature look different than how you use the method in 99% of cases.
|
# ? Sep 1, 2017 03:29 |
chutwig posted:What are you people doing with Git that makes you feel like you need an army of shell scripts to manage it? Nearly all of my Git usage can be distilled down to 10 commands: I used my first git shell script today! It was this github-provided one which changes author info throughout a project's history.
|
|
# ? Sep 1, 2017 03:34 |
|
Asymmetrikon posted:self is preferential to an implicit this, but it is obnoxious how it makes the method's definition signature look different than how you use the method in 99% of cases. I like the way it's done in Lua, where a method call is syntactic sugar for a function call with the owning table given as the first parameter.
|
# ? Sep 1, 2017 05:36 |
|
This discussion reminds me of a coding horror perpetrated by inexperienced C API writers: forgetting to add a void* pData parameter to the signature of a function setting a callback. I did this once or twice, but fortunately not for libraries that ever had to be used out of house
|
# ? Sep 1, 2017 05:40 |
|
TooMuchAbstraction posted:Look, you're not supposed to prematurely optimize. That means you don't have to care about runtime whatsoever until it becomes a problem, right? This is with 5 users and its supposed to run with 1000s using the system, The issue is that they have central microservices that have single threads and single queue, meaning that there is a bottleneck with the queue, We ran up 5 microservices (their suggested amount) and the processor was running at 2% cpu and in my first post I got the figures wrong, it was 15 minutes not seconds for the response. When we ran up the extra services it then increased the speed and CPU usage jumped to 20% and the page response decreased to about 5 minutes. The issue here is that the old system has delays on some of the large pages of say 30 seconds to 1 minute and the new "faster" one is about 10 times slower.
|
# ? Sep 1, 2017 09:12 |
|
PhantomOfTheCopier posted:I work on some projects in CVS; I'd have to ask what people _think_ they are doing in git that's so much more impossibly difficultingly world-ending in CVS. Here's why you don't think they're different: PhantomOfTheCopier posted:All the git reflog history rewriting carap, yeah I've only ever worked where git repositories permit no rewriting of history; once you push, it's recorded for all to see. PhantomOfTheCopier posted:I mean a real branch, in the repository
|
# ? Sep 1, 2017 13:37 |
|
"I'm surprised you can use your mac for development and use git on it." "Of course I can, it runs natively in my environment. Git was created by Linus Torvalds to manage the Linux kernel, ..." "How did you learn all this?" Something seems wrong with the hiring practices at my current job.
|
# ? Sep 1, 2017 14:54 |
|
TheresaJayne posted:This is with 5 users and its supposed to run with 1000s using the system, To be clear: I was being sarcastic. A common bit of conventional wisdom is that you never prematurely optimize, because you may spend a lot of effort on something that ends up not mattering significantly (e.g. improving disk I/O on something that's CPU-bound). It'd be easy to interpret that as saying "you shouldn't worry about performance whatsoever until you discover that you can't scale". But there's a difference between not optimizing your code, and not giving any thought to its performance. Good designs take scaling requirements into account .
|
# ? Sep 1, 2017 16:29 |
|
CPColin posted:Something like 2.5 weeks into my new job, I got my first look at a small bit of the code. It's a utility class that's 2,077 lines long and has an 818-line method in it that's one giant switch statement. There's also a bunch of stuff that was clearly copied and pasted. Good target for refactoring, right? Well, too bad, because there's no test coverage, as far as I can tell! Imagine ten functions like this, where the only differences are the type of Thing and sometimes the date format includes the time: code:
That JsonPostPut function does the following:
|
# ? Sep 1, 2017 17:52 |
|
code:
|
# ? Sep 1, 2017 22:26 |
|
CPColin posted:
I mean, that's basically the classic "return (a == b) ? true : false" in a slightly different form.
|
# ? Sep 1, 2017 22:58 |
|
CPColin posted:
What the hell is this lol. Please tell me there is context that at least lets you get on the train of thought applied here.
|
# ? Sep 1, 2017 22:58 |
|
There was probably some debug logging stuffed in there at one point.
|
# ? Sep 1, 2017 23:08 |
|
TooMuchAbstraction posted:I mean, that's basically the classic "return (a == b) ? true : false" in a slightly different form. Oh, that's in here, too: code:
ChubbyThePhat posted:What the hell is this lol. Please tell me there is context that at least lets you get on the train of thought applied here. Other functions pass the non-null JSON value to some other function for further processing, before returning it, so I'm guessing somebody did a copy-paste of one of the more complicated functions, realized they didn't want that call, stripped it out, and left the rest of the code where it was.
|
# ? Sep 1, 2017 23:12 |
|
Ranzear posted:There was probably some debug logging stuffed in there at one point. I hadn't thought of this. This would make a lot of sense.
|
# ? Sep 1, 2017 23:44 |
|
raminasi posted:Here's why you don't think they're different: "Branch" is overloaded in git. A "local set of commits" is, obviously, not in the repository and prone to data loss; create and push a branch. I've seen junior engineers tear out their hair because they think they'll be cute and create local "branches", then they find out that git blocks them when they have unstaged changes that they don't want to commit anyway, or untracked files that they don't want to commit but don't follow their local branch, or... more likely, that they can't actually run tests because a branch switch introduces different build dependencies. In the end, they realize that `rm -rf` and `git clone repo dirname` are common in git workflows, and they end up with multiple local directories for their local work. Indistinguishable from CVS. Coding horror: People that drink the git koolaid then spend three hours drawing pictures of branches and local stashes trying to figure out how to cherry pick their upstream remote rebased merge conflicted mess. Also, if you're rewriting history in a shared and/or production repository you are bad and you should feel bad. Fake edit: I'll find some horror that looks more like actual code. It's hard to find in CVS since it's so beautiful.
|
# ? Sep 2, 2017 07:03 |
|
You sound like someone who has never actually used (or even made an effort to use) git beyond "what git commands are equivalent to these CVS commands I already know". And no poo poo, if that's all you know about git then you're not going to understand how it's different from CVS. Suffice to say that no, cloning the same remote into multiple different local repositories is not common git practice at all.
|
# ? Sep 2, 2017 08:03 |
|
PhantomOfTheCopier posted:Also, if you're rewriting history in a shared and/or production repository you are bad and you should feel bad. CVS model is fine, but I don't understand how this is possibly true. What is wrong with rewriting history with the history writing tool, git?
|
# ? Sep 2, 2017 08:28 |
|
Jabor posted:Suffice to say that no, cloning the same remote into multiple different local repositories is not common git practice at all. It is if you're working on multiple branches, and switching branches entails a 2+ hour recompile...
|
# ? Sep 2, 2017 09:04 |
|
Zopotantor posted:It is if you're working on multiple branches, and switching branches entails a 2+ hour recompile... I assume the branch switch changes some fundamental files everything else references so it can't reuse object/intermediate files from the other branch?
|
# ? Sep 2, 2017 09:09 |
|
Linear Zoetrope posted:I assume the branch switch changes some fundamental files everything else references so it can't reuse object/intermediate files from the other branch? Interface definitions & headers, yeah. We have gotten better lately, there are actually people working on improving build times now.
|
# ? Sep 2, 2017 09:24 |
|
Zopotantor posted:It is if you're working on multiple branches, and switching branches entails a 2+ hour recompile... https://git-scm.com/docs/git-worktree may be of interest. Saves on duplicated objects in a way that's less fragile than cloning with --shared and on the manual effort of keeping multiple local repositories synchronised, since fetching in one workspace updates branches in all the workspaces.
|
# ? Sep 2, 2017 10:06 |
|
Coffee Mugshot posted:What is wrong with rewriting history Jabor posted:You sound like someone... I have used git, from the ground up, in many gity ways, learning from the "git source material", not from "A CVS user's guide to git" or anything, and watched people repeat all sorts of terrible patterns with it. The same basic mistakes, pointing out the fundamental flaws in the system, are made by most junior engineers. I posted a comparison to state "This is why CVS is easy", not "These are the only git commands I use". Learn to read. I've pointed out a few bad patterns in git. If you want to know what I really dislike about git, I can certainly give a complete list, but I don't know if this is the right forum. I didn't say all of git sucked. If you don't like CVS, don't use it, but be aware that it's not scary; it's easy and straightforward. Most of my CVS experience has happened after my production git experience. I've demonstrated the ease of CVS by comparison. Proof by popular opinion of a different system is not a viable counter-example. Anyway I'm relatively new in this thread and feel this is enough of this pseudo-on/off-topic topic, so moving forward... I wish I could find the Chef script that team wrote to randomize the crontab entry for a hardware info collection script. They were all checking in at midnight and it was blowing over the receiver, so someone had the nice idea to randomize the times. So they used Chef to "echo RANDOMTIME hardware-information.sh >> /etc/crontab". To ensure consistent system config, Chef ran every 30min on all servers in the fleet. Two weeks later, the receiver toppled because every host was checking in 10k times per day because the Chef script wasn't idempotent; of course they couldn't clean it up with their all-poweful automated Chef; they had to pull in someone who knew proper scripting to SSH to every server in the fleet.
|
# ? Sep 2, 2017 10:39 |
|
Okay sure, here's my workflow and you tell me how it's just so simple in CVS. - I do a bunch of work - I send that work to a coworker for code review - I continue working on the next bit (which depends on the changes I just sent for review) while waiting for my coworker to get around to reviewing the code - My coworker makes some comments that necessitate some changes - I go back and make changes in light of those comments, then send it back. It could go back and forth like this a fair bit. - Concurrently, I'm working on the next bits that depend on the code being reviewed. Sometimes I want to pull the latest iteration of changes forward immediately, other times I want to wait and keep working against the previous version until I'm ready to merge things forwards. In git this is dead easy. I have no idea how you'd do it in CVS, though I'm sure a master like you can point to the commands that I'm missing.
|
# ? Sep 2, 2017 12:07 |
|
Jabor posted:Okay sure, here's my workflow and you tell me how it's just so simple in CVS. Oh I know this one 'cvs co butts' in some other directory and then manually manage and track multiple copies of the repository. After you've done the back and forth, diff/patch your intermediary repo back to the real one. Lol cvs is trash
|
# ? Sep 2, 2017 13:04 |
|
code:
|
# ? Sep 2, 2017 15:06 |
|
fun fact: it's called cvs because you're gonna need lots of pills to make the pain go away
|
# ? Sep 2, 2017 15:19 |
|
GenJoe posted:You are a 2-3 person development shop, and you need to build out a relatively complex web application. Node.js is appealing because: I love Javascript for what it's good at. I've used Node a decent amount. Just, most of the time you should probably consider other options unless it's a small project or really time constrained. Javascript feels like you're perpetually prototyping. Khorne fucked around with this message at 16:04 on Sep 2, 2017 |
# ? Sep 2, 2017 15:47 |
|
PhantomOfTheCopier posted:Rewrite history in production repository, build, deploy. Repeat ad naseum. Production outage appears from low-occurrence scenario based on some change that was put in place several weeks ago. You try to isolate the change only to realize that you have to rollback the world for the last month because people have been rewriting history, and you have no idea how to correlate issue timestamps to code deployments because there are no timestamp-matched commits in the repository anymore. You drop multiple $100k in annual revenue because you can't isolate a rollforward/rollback. In other words, You're hosed. It's getting hard to engage you on weird strawmen like this. Yes, it is possible for this to happen with git. It doesn't though, because just because you have a history rewriting time machine doesn't mean you let everyone have the keys. People are responsible for their rollbacks and rewriting history is a part of that process of fixing up a branch. This is not a git problem, the solution isn't a cvs solution, though. No one loses $100k annual revenue because of the tool.
|
# ? Sep 2, 2017 16:17 |
|
|
# ? Jun 7, 2024 17:06 |
|
Linear Zoetrope posted:I assume the branch switch changes some fundamental files everything else references so it can't reuse object/intermediate files from the other branch? I do something similar with the code in https://github.com/gcc-mirror/gcc; a checked out repo for each branch. A different branch implies re-running your configure script, most likely, and as such, you probably want to rebuild any artifacts that might existed (might be missing linker flags or other extra environment set in the configuration). Depending on how you are building gcc (quick build, no opts vs stage3 comparison for testing), it can take 40min - couple of hours on 12 cores (make -kj12). This is just a compiler problem, though. Coffee Mugshot fucked around with this message at 16:25 on Sep 2, 2017 |
# ? Sep 2, 2017 16:22 |