Speaker: Scott Wierschem
For more, see the table of contents
- “I’m not a great programmer.. I’m a good programmer with great habits” – Kent Beck
- 90% of time reading code (vs writing) – Robert C Martin from Clean Code
- 58% time understanding code – IEEE
- Content vs intent
Reading Prose vs Code
- Prose is passive, remember general details, constant forward flow, relaxing and enjoyable
- Code is active reading, understand everything in detail, loops/jumps/subroutines/async, exhausting hard word
Why code hard to read
- Variable names
- Long methods
- Variable state
- Complicated control flow
- Long files
- Someone else wrote it
- I wrote it, bus must have been drunk
- No docs or old/wrong docs
- Not following code standards
- Magic numbers
- Reused variables (ex: second purpose in method)
- Global variables/singletons
- Bad naming
- Magical annotations
- Using new feature in language before understanding where fits
Why read code?
- Learn how it works to enhance or fix
- Learn how library/framework works
- Learn different programming techniques – learn from other people
- Code review – paid to read it
- Book recommendation: The Programmer’s Brain
- FIlter info and put in short term memory – 3-5 items; only lasts about 30 seconds
- Associated info with something and then in long term memory
- Load from short and long term memory into working memory
- Working memory typically 2-4 items
Confusion when reading code
- Lack of knowledge – ex: APL (a programming language) – Greek symbols
- Lack of information – ex: not knowing what a lambda does
- Lack of processing power – ex: too much complexity
- Flashed characters for a second or two.
- Cyrlic. Remembered one character
- Random letters. Remembered three characters. Characters in long term memory.
- Three words. Remembered all three. Words in long term memory. Chunking – grouping together familiar patterns.
- Persistence of vision
- Look at shape of code ex: of statement
- Can see indents even in minimap where code is tiny (CodeGlance Pro plugin for IntelliJ; Eclipse/VS Code have setting)
- Design patterns for chunking
- Comments – new people rely on a lot more. Experienced people burned by docs and learn to remove.
- Print code and write on it as external aid
- Create dependency graph – print out/highlight or use a tool – https://annotate.codereading.club/
- Use a state table – write down values of variables as go thru code/loops
- Simple Beacon – good variable name
- Compound Beacon – combinations
- Help future readers of code
- Intentionally included to make easier to read/understand
- Whitespaced for sections of code
- Eye drawn automatically to bits of code
- Faster to make associations when know more
- Faster to learn
- Break flow to google.
- Takes average 15 minutes to get back to where you were
- Remember through repetition; memory decays. The decay is slower over time. This is why spaced repetition works. ankiapp.com, cerego.com, quizlet.com)
- Long term memory is good. Retrieval doesn’t always work. Practice helps. Try to guess before look it up.
- Intrinsic – complexity of problem
- Extraneous – outside distractions
- Germane – storing thought in long term memory
- Reduce load by refactoring – break it up, remove duplication, simplify, sometimes unroll function call, avoid unfamiliar language constructs (ex: ternary operator)
- Can have IDE refactor for you without understanding first
- Add confusing constructs to flash cards so can make association faster next time
- Write down what concept makes you think of; what is related
- For each concept, think about why related. ex: syntax, context
- What other ways can accomplish same goal? ex: other programming languages
- Does it fit a paradigm, domain, library, framework, etc
- IDE plugins – syntax coloring, indentation lines, plugins. Know your IDE; know the features
- Paper and pen – colored pens/pencils, highlighters
- Debugger – conditional breakpoints [these are great]
- Profiler – call stacks
- Log files
I’m a morning person, so I wasn’t sure how live blogging at a talk at 8:30pm would go. It was right after dinner though so that helped me stay alert. It helped that he had a lot of interactivity. I still had trouble concentrating as much as I could earlier in the day though so I’m sure I retained less. Good thing I have this blog post. I will say brain being worn out was very reinforcing when finding code with higher cognitive load!
Speaker: Ken Kousen
For more, see the table of contents
- Tools are improving fast, might not be needed as job
- Suggest context (ex: “pretend you are”)
- Give example of what you want
- Free version is GPT 3.5 Turbo (improved performance over original 3.5)
- $20/month for GPT 4. Can make 25 requests in a three hour block.
- Have not noticed quality control over plugins.
- Plugins change rapidly.
- Apologizes when you correct it.
- Warning about pasting your company’s code in
- Trained thru summer 2021
- Can’t read files on local file system (Bard can). Can read link but doesn’t know it can
- Often wrong if you ask it about whether can do something. Like talking to toddler; says want thinks want to know.
- Temperature – tweaks creativity vs precision
- REST API docs
- REST API: cookbook has examples
- Must give credit card to call REST APIs. Pennies are for 1000 tokens (about 750 words). Charged for both input and output words. Also limits on context (amount GPT remembers). Not expensive if don’t use it much. Ken’s bill has been pennies and too low to be sent a bill.
- REST API JSON response says how many tokens used. Can also see graph when log into account
- Had it make multiple choice questions on a topic
Chat GPT Code Interpreter
- Code Interpreter beta feature.
- Need to explicitly enable under settings.
- From OpenAI, not third party
- ex: can convert Groovy to Kotlin DSL for Gradle
- First popular text to image generation tool
- A generation behind text/GPT.
- Stable Diffusion free, but behind on quality
- Prefers MidJourney, more realistic
- Audio to text
- Takes audio or video and writes transcription.
- Free (unless use REST API)
- Mac Whisper – $20 on time fee for larger models. Good for transcribing videos of talks. Slow first time. After that (including other videos, fast. [caching?]
- Creates .srt file (Subtitles)
- Free beta
- Only available in US and UK
- Can hold 100K tokens. ex: can summarize a novel
- Quality comparable to ChatGPT 3.5, but not as good as 4.0
- Can upload many file types
- Harder to get back to previous conversations than ChatGPT. Need to click on “A” icon on top to see them
- Doesn’t do image
- Can upload answers to Google docs on Ken’s personal account, but not business account
- Used to be able to answer who Venkat is but can’t anymore.
- Meta announced today
- Pretrained language model
- Free unless large company (aka: competitors)
- Transcribes and edits video
- Can give instructions – ex: shorten gaps in video, remove filler words
- If don’t move around much, will make it look like you are looking at camera
- Can give text and select a voice. With 30 minute sample, can train on your voice
- Can describe presentation want and Canva makes a draft
- Can choose theme from list of choices
- Magic eraser – brush over part of image don’t want and replaces with background nearby
- Beats Sync – line of slide transition to beats of music
- Magic Write – like GPT 3.5
- Magic Design – give own image and make presentation around that
- Virtual pair programmer
- Plugins for VSCode and IntelliJ
- If hesitate, suggests code
- Can’t agree to part of suggestion. Need to accept it all or delete
- Guesses right a lot because knows what have done before in a training class
- Always looks plausible because trained on own code. Need to look carefully
- Next generation is GitHub CopilotX. Only available via wait list. VS Code only at this point, can use for pull requests.
- GitHub Next – tools in a variety of states – https://githubnext.com. “Visualizing a Codebase” runs as github action to see packages
IntelliJ AI Assistant
- Not much documentation on how it works. Only one blog post
- In Ultimate, not Community
- In beta edition
- Can highlight code and ask to explain it
- If don’t like suggestion, can request it suggests something else and get more choices
- Can write commit message for you
- Find issues with code when know language well
- Helps in language know less well because it knows the API/syntax
- Good for nuisance tasks that would take a lot of time
- Get summary or transcript of video
- Up to 20 minute video
I was doing my interview with the Build Propulsion Lab so was a few minutes late. It was a full room so my seat was on the floor. Luckily, the room had a large aisle so I could sit near the front instead of in the very back! And the carpet was comfy.
As far as Ken’s actual talk, it was great. I liked the overview of a bunch of tools and seeing the REST APIs for calling OpenAI. Great breath of topics and fun examples! I learned a lot including some tools I hadn’t heard of. And some very cool functionality!
Speaker: Venkat Subramaniam
For more, see the table of contents
- Incubator phase feature
- Anything can change.
- Will be a year or more before release
- use –enable-preview flag
- Java prints out warning using incubator feature whenever run program
- Since Java 5
- executorService.submit() -> logic()) – returns future. Call future.get() when done
- executorService.awaitTermination(10, TImeout.SECONDS)
- Allow control of what happens on parallel
- Parent handles/processes failures from children
- Currently import jdk.incubator.concurrent – will move
- StructuredTaskScopeShutdownOnFailure – invoke all
- StructuredTaskScopeShutdownOnSuccess – invoke any
- try (var scope = new StructuredTaskScope()) – want autoclose – or scope = StructuredTaskScopeShutdownOnSuccess() or scope = StructuredTaskScopeShutdownOnSuccess<String>()
- scope.fork(() -> logic()) – makes child tasks, still returns a Future
- scope.join() – don’t use – better to use a timeout so not unbounded waiting on children
- scope.joinUntil(Instant.now().plusSeconds(50)) – better, uses timeout. waits for all children up to timeout Nice using Java date math
- future.resultNow() – get result immediately. (vs get() which waits if not available)
- scope.throwIfFailed(ex- > handle()) – deal with first failure
- ThreadLocal not useful in Spring because thread executing code not the same one that created the value
- Scoped value, not scoped variable. Immutable
- Hide the value instead of changing it
- New value available in inner value. When get back out of that scope, see original value.
- Doesn’t matter which thread runs the code because matters where you are in code.
- Useful when calling a lambda which does a callback via third party code
- Created ScopedValue field in the class that needs the data.
- ScopedValue.newInstance() – placeholder, doesn’t have value yet
- state.isBound() – whether has been set to a value
- ScopedValue.where(state, “test”).run(lamba) – binds the value
- state.get() – get value if bound. Blows up if not bound
As an incubator feature, I knew nothing about this. It was great to learn about it from a Venkat talk. Different then the usual which is something I do know about and am learning deeper. I also enjoyed the airport code jokes: IAH (Houston – i am here), IAD (Dulles – i am delayed), and ORD (Chicago – ordeal). I’m always impressed Venkat can live code in front of so many people. I’d never seen incubator code in use. Nice it gets a temporary package name; can’t use it by accident. Venkat used IntelliJ to create a module. I don’t think I’ve ever seen him use IntelliJ :). Great audience questions on structured task scope. The scoped value thing made my head swim for a bit, but I get it now.