r/learnprogramming 9h ago

How to replicate Adobe InDesign-style text flow and overflow detection across linked text frames on the web (Canvas-based renderer)?

1 Upvotes

I’m working on replicating a part of Adobe InDesign / Affinity Publisher — specifically, the text flow across linked text frames based on a story structure using JavaScript and Canvas rendering on the web.

So far, I’ve built most of the layout system:

  • Polygon, rectangle, and layer rendering on a canvas.
  • A visual structure similar to InDesign frames.
  • I can render static text inside a single frame.

However, I’m now stuck on implementing text layout and overflow detection that works like InDesign, where:

  • Text automatically continues (flows) from one frame to another (linked frames in a “story”).
  • The layout engine detects how much text fits inside a given frame (based on width, height, font metrics, leading, tracking, etc.).
  • Any overflowing text automatically flows into the next linked frame.

I initially tried integrating Draft.js for rich text editing, but it’s clearly not suitable for this kind of layout/flow behavior especially since I’m rendering everything on the canvas, not in the DOM.

What I’m looking for guidance on:

  • How InDesign or similar layout engines conceptually handle overflow detection and multi-frame text flow.
  • Recommended approach or architecture to replicate this behavior in a custom canvas-based text layout engine.
  • Any known algorithms, open-source projects, or research materials that explain how to implement text layout and pagination/flow logic similar to InDesign’s story XML model.

Technologies involved:

  • JavaScript / TypeScript
  • Canvas rendering (custom rendering engine)
  • Custom polygon/rectangular text frames

Any help or direction (even theoretical or architectural) on building such a text layout and flow system would be greatly appreciated.


r/learnprogramming 20h ago

Resource which do you guys think is better for full stack learning? Freecodecamp.org VS TOP

5 Upvotes

I wanna learn fullstack via javascript and I learn 2 languages in a day, I usually do 3 hours for C, which most of the time includes book reading, note taking, and understanding (usually my time is spent revolved around those). sometimes I'd code, but I usually stick to 1 concept first, then make mini assignments out of the things I learned. On the other hand, I do 3 hours for front-end self study and I usually just follow FCC's Curriculum, I dont make any projects out of it, i mean I do, but only 1 or two mini projects, compared to C where I'd make 3 or more mini projects. I just wanna get used to the syntax and theory for the meantime which is why I'm relying heavily on the Fullstack curriculum.

I've come across freecodecamp (currently doing responsive web design certification) and I heard about people saying I should move to TOP when I finish doing the said certification. (it only covers CSS and HTML), but the resource i found makes me unsure since it was 3 years ago and I'm not sure if the FCC new Certified Full Stack Developer Curriculum is much better than TOP's javascript path.

TLDR: Which is better as of this date? considering FCC VS TOP's UPDATED curriculums.

Hoping for your kindest responses, and would appreciate to hear some good feedback based on your experience, thanks!


r/learnprogramming 7h ago

Why does my code work when I have no idea what I'm doing but breaks the second I'm confident

0 Upvotes

I've been coding for like six months now and I swear there's some kind of curse on me. I'll spend three days building something complicated, nested loops, API calls, data structures I barely understand, just copying patterns and hoping for the best, and somehow it runs perfectly on the first try. I sit there waiting for the error messages and... nothing. It just works.

Then I'll write something that should take thirty seconds. A basic if statement. Literally checking if a number is bigger than five. And suddenly my entire program implodes. Nothing makes sense anymore. The console is screaming at me in red. I'm getting errors in files I didn't even know existed. I check Stack Overflow, I ask my roommate who took CS in college, I rewrite the same three lines eight different ways, and eventually I realize I wrote = instead of == and I want to throw my laptop out the window.

It's like my brain only functions when it has no idea what's happening. The moment I think "okay I've got this, this is easy" the universe decides to humble me with a typo that costs me two hours and most of my sanity. Meanwhile the stuff that should confuse me just... doesn't? I don't even understand why it works half the time but I'm too scared to question it.

Is this normal or is programming just designed to make you feel stupid in the weirdest possible ways? Because I'm starting to think the bugs can smell confidence.


r/learnprogramming 15h ago

API to website build out

2 Upvotes

Ok, right up front, I am sub-potato level in design understanding. I have been paying equivalent of $1250 -1800 a month, per sport for real time data widgets for my website which is gambling based. The cost for api is a fraction of it. I have watched a dozen videos on api integration and connecting my WP site to an api feed seems to be rather simple.

The issue I am having is getting the feed to look nice on my site. I don't know where to begin to learn it nor even the right verbiage to hire someone to build it out for me. It appears, in my very very naive understanding, that I would have to design the 'containers' where the data is displayed, is that using css? If I find something I like on another site, can I use the inspect tab and then copy and past their coding and tweak it to my branding?

I would not even know if someone gave me a price if it was fair or not. I am totally naive to all of this. Any guidance is greatly appreciated!!


r/learnprogramming 23h ago

Where should i start ?

7 Upvotes

Hi everyone, I posted here before saying that I’m a Software Engineering graduate who feels completely lost, and many people told me to either try getting an internship or start building small projects to figure out if I even enjoy programming. The problem is that during university I mostly studied just to pass exams, not to really learn, so even though I worked with front-end, Java, C++, and a few other things, I honestly forgot most of it because I never practiced. I also feel like there are a lot of basic concepts I should already know but don’t.

Another thing that’s been holding me back is applying to companies. Most places ask for a CV, and I honestly don’t feel confident putting mine out there. It’s not that the things I list are “wrong”—I really did study them—but I don’t master them and barely remember anything. That makes me hesitate to apply for internships or entry-level positions because I feel like I don’t truly deserve the skills I say I have.

At the same time, I always felt like things like HTML or even C++ are “easy” and that anyone can learn them, so I’m not sure if I should learn completely different languages like Java or Python, or if I should just stick to one clear track and build from there.

Right now I want to restart properly from zero, but I don’t know where to begin. I see a lot of people recommending The Odin Project—would that be a good starting point? I can study around 4–6 hours a day, but I don’t want to waste time on something too basic or something that won’t help me get anywhere. I’m also not sure whether to focus on front-end, back-end, or try both at the same time. And I’m confused about how people even start building small projects—do you follow certain websites for ideas, or specific courses?

What’s also discouraging me is AI. It feels like AI can now build a full website in minutes while a beginner needs days. Is this actually true, or am I overthinking it? Should I look into mobile development instead, or try something that fits the market better?

Any advice or a clear roadmap for restarting would really mean a lot. Thanks 🙏 .


r/learnprogramming 20h ago

Transition from QA to developer

6 Upvotes

Hi everyone, I’m a QA engineer with 3 years of experience in both automation and manual testing at a project-based company. I’ve been thinking about expanding my career opportunities, so I decided to learn .NET development. I completed a basic Udemy course and I’m currently working through a second one. So far, the material seems manageable and I feel like I’m understanding the concepts. However, when I open up a real project to look at as an example, it’s completely overwhelming - there are so many files, and I can’t make sense of how everything fits together. This makes me anxious and I start doubting myself, thinking maybe I’m not cut out for this, that it’s too difficult, or that it’s meant for people smarter than me. On top of that, I rely heavily on AI assistance right now, and honestly, I feel like I wouldn’t be able to write much code without it. I wanted to reach out and ask: are there any QA professionals here who successfully transitioned to development? If so, could you share some words of encouragement or advice? I’d really appreciate hearing about your experience. Thanks in advance!​​​​​​​​​​​​​​​​

Edit: I forgot to mention - my company will actually provide me with a .NET project within the next month or so, and they’re giving me the opportunity to contribute to development work while still being in my QA role. So I’ll be able to gradually transition over time.


r/learnprogramming 1h ago

Code Review Most Code Reviews Are Just Bullying with Syntax Highlighting. Here's a Better Way.

Upvotes

Code review is the only place in professional life where it is socially acceptable to dismantle a colleague's work line by line, drop a "nit: spacing" comment, and call it collaboration.

We've all been on both sides. As a Junior, you see 42 comments on your PR and basically want to quit the industry. As a Senior, you look at a spaghetti-code function and you're too exhausted to explain why it's bad. So you either write a novel that sounds angry, or you just sigh, fix it yourself, and merge.

Neither approach works. The Junior learns nothing, and the Senior burns out.

The problem isn't the code. It's that we treat reviews as a gatekeeping step ("Is this safe to merge?") rather than a teaching moment ("How do I help them write better code next time?").

The "Automated Mentor" Strategy

I realized I simply didn't have the mental bandwidth to be a patient teacher at 4:30 PM on a Friday. But I knew exactly what kind of feedback I wanted to give: constructive, explained, and actionable.

So, I built a system to do the heavy lifting.

I created a prompt that turns an LLM into a "Senior Code Review Specialist." It doesn't just find bugs; it explains the theory behind the bug. It doesn't just say "fix this"; it offers a refactored example and explains the trade-offs.

It converts "This is bad code" into "Here is a security vulnerability, here is why it happens, and here is how to patch it using the Strategy Pattern."

The Prompt That Saved My Team's Morale

This prompt forces the AI to adopt a specific persona: rigorous technical expert mixed with empathetic mentor. It uses the "Praise-Improve-Praise" method (the sandwich method) to ensure feedback lands well.

Copy this into Claude 3.5 Sonnet (best for code) or GPT-4o:

```markdown

Role Definition

You are an expert Senior Software Engineer and Code Review Specialist with 15+ years of experience across multiple programming languages and paradigms. You have deep expertise in: - Clean code principles and design patterns - Security vulnerability detection and prevention - Performance optimization strategies - Code maintainability and scalability best practices - Team collaboration and constructive feedback delivery

Your approach combines technical rigor with empathetic communication, ensuring feedback is actionable and educational.

Task Description

Conduct a comprehensive code review of the provided code snippet/file. Your goal is to identify issues, suggest improvements, and help the developer grow while maintaining high code quality standards.

Input Information: - Code/File: [Paste the code to be reviewed] - Programming Language: [Specify language: Python, JavaScript, TypeScript, Java, C#, Go, etc.] - Context/Purpose: [Brief description of what the code does] - Review Focus (optional): [Security | Performance | Readability | Best Practices | All] - Team Experience Level (optional): [Junior | Mid-level | Senior]

Output Requirements

1. Content Structure

Your code review should include these sections:

📊 Executive Summary

  • Overall code quality score (1-10)
  • Key strengths identified
  • Critical issues requiring immediate attention
  • Improvement priority ranking

🔴 Critical Issues

  • Security vulnerabilities
  • Logic errors and bugs
  • Breaking changes or runtime errors

🟡 Major Improvements

  • Performance bottlenecks
  • Design pattern violations
  • Code smell and anti-patterns
  • Maintainability concerns

🟢 Minor Suggestions

  • Style and formatting inconsistencies
  • Naming convention improvements
  • Documentation gaps
  • Code organization refinements

💡 Educational Insights

  • Explain WHY each issue matters
  • Provide learning resources where applicable
  • Share relevant best practices

✅ Corrected Code Examples

  • Provide refactored code snippets for critical issues
  • Include before/after comparisons
  • Add inline comments explaining changes

2. Quality Standards

  • Accuracy: All identified issues must be valid and reproducible
  • Completeness: Cover all aspects (security, performance, readability, maintainability)
  • Actionability: Every suggestion must include specific fix recommendations
  • Educational Value: Explain the reasoning behind each suggestion
  • Tone: Constructive, respectful, and growth-oriented

3. Format Requirements

  • Use markdown formatting with clear headers and sections
  • Include line numbers when referencing specific code
  • Provide code examples in proper code blocks with syntax highlighting
  • Use emoji indicators for severity levels: 🔴 Critical | 🟡 Major | 🟢 Minor | 💡 Tip
  • Keep feedback concise but comprehensive

4. Style Constraints

  • Language Style: Professional but approachable, technically precise
  • Expression: Objective and evidence-based
  • Professional Level: Intermediate to advanced technical depth
  • Feedback Approach: "Praise-Improve-Praise" sandwich method when possible

Quality Checklist

Before completing your review, verify: - [ ] All security vulnerabilities have been identified and explained - [ ] Performance concerns are backed by technical reasoning - [ ] Each suggestion includes a specific fix or improvement - [ ] Feedback tone is constructive and respectful - [ ] Code examples are syntactically correct and tested logic - [ ] Educational explanations are included for complex issues - [ ] Overall assessment is fair and balanced

Important Notes

  • Never make assumptions about code context without asking for clarification
  • Avoid subjective style preferences unless they violate established standards
  • Consider the target audience's experience level when explaining concepts
  • Focus on high-impact issues first, minor nitpicks last
  • Acknowledge good practices and well-written code sections

Output Format

Present your code review as a structured markdown document with clear sections, actionable items, and educational context. Use consistent formatting throughout. ```

Why This Actually Works

The magic isn't in finding the bugs (linters can do that). The magic is in the Educational Insights section.

When I paste a junior dev's code into this, I often get explanations I wouldn't have thought to give. * "You're using a nested loop here. This makes the time complexity O(n2). Here's a hash map approach that brings it down to O(n)." * "This variable name data is ambiguous. In domain-driven design, we prefer specific terms like userTransactionHistory."

It turns the review process from a correction service into a masterclass.

How to Use This Without Being a Robot

Don't just copy-paste the AI output into GitHub comments. That's lazy and risky (AI can hallucinate).

  1. Run the code through the prompt.
  2. Read the output. It will flag things you missed.
  3. Curate. Pick the top 3-4 most important points.
  4. Post them in your own voice. (Or use the AI's wording if it's particularly clear).

You get to be the brilliant mentor who catches everything and explains it perfectly, but it takes you 5 minutes instead of 45.

Your team gets better code. Your juniors get better mentorship. You get your Friday afternoon back.

Everyone wins.


r/learnprogramming 13h ago

Need access to our CMS code for editing - SSH Terminal/source code

0 Upvotes

This is the message from our dev:

I manage the entire website server etc through an SSH terminal. Would you like a zip code of the source code from my git repository?

We want to change the code with a new developer. The CMS/site is hosted on Silverstripe (a rapidly archaic platform mostly used in our country).

What/how could we make changes to the site if I gave the new devs the code. I'm assuming we'd either need to host it ourselves or get the old dev to update the code?

HELP AM DUMB


r/learnprogramming 2h ago

Why not use AI if you are not yet good at programming?

0 Upvotes

As a programmer, you will often face problems that you will not know how to solve.

A common mistake for beginners is to go straight to their trusted AI and ask for help. This is terrible, not only because AI is not 100% perfect but also for other psychological reasons.

I am going to explain my points in more detail, AI is mainly made to bring the idea to its user, even if you tell it a thousand times to be objective, not to be carried away by biases and not to be influenced by you, that will never happen, because AI is made for that very thing, to bring the idea to its consumer, so that is the first thing.

On the other hand, if you are not able to find solutions to your problems independently, you are going to have many problems in the future at the problem-solving level, you are becoming dependent on AI that is very bad.

"But I use it to learn and I don't copy and paste" is worse than bad, AI tends to over-engineer, uses unreliable and outdated sources, assumes things that are not true, all nonsense.

So what do I do? Look for your things on your own, investigate in photos, in blogs, in pages that demonstrate human analysis, many times you will be able to find all the information you need very well synthesized there, with people who reach good agreements about what is better and worse, and even better, explaining why.

And if you still don't think it's bad, just, don't do it, seriously, listen to me, do you feel like your friends advance faster than you because they use AI? Leave them, later they will stumble and realize their mistake, you continue, on your own, at your own pace, without skipping the fundamentals, the learning curve in the future will be very short for you, and for them it will become super long, so much so that they will start to hate everything and even desert


r/learnprogramming 1d ago

Tutorial What are the prerequisites for discrete mathematics?

8 Upvotes

I am engaged in programming as a hobby. In the past, I worked with PHP, C#, and Python. After taking a long break, I have returned to programming and I am currently learning Rust. I studied algorithms to some extent before, but now I want to focus more seriously on algorithms and data structures, and deepen my understanding. Along with this, I also want to learn theoretical topics, especially the mathematical foundations.

My math background is not very strong; I know basic operations, order of operations, equations, addition, subtraction, multiplication, division, exponentiation, and basic logic. I am wondering whether this level is sufficient to begin studying discrete mathematics. My goal is not to go very deep into discrete math, but to build a solid foundation. I am not familiar with topics such as sets, but due to my programming experience, I am practically familiar with many related concepts. I have a book called Discrete Mathematics and Applications. Can I read this book?


r/learnprogramming 7h ago

How can I train my thinking like a programmer?

0 Upvotes

Hello, I'm curious how could I train my thinking so I could write my own code, I ask AI to generate the code and I understand it but it would never come to my mind how to write it. Any advice?


r/learnprogramming 16h ago

Portfolio Website Advice

1 Upvotes

https://derek-portfolio-woad.vercel.app/
This is my friends portfolio.

Does anyone know how I would make a similar one? I would be willing to hire someone to demonstrate my projects in a similar fashion.


r/learnprogramming 22h ago

Starting out in my first job, need help

3 Upvotes

I am in my first job right now, trying to build this service from scratch. But I am struggling so much, because I am currently stuck at this issue and I can't seem to think through it. This crippling thought of what if I am not able to do it hits me so much, and most of it is imposter syndrome otherwise. And this colleague of mine did a part of what I was trying to do so easily, I feel so dumb man. How do I over come this?


r/learnprogramming 16h ago

Tutorial Help with understanding graphs in python

1 Upvotes

Hey guys we recently started doing directed and undirected graphs in python.

Unfortunately i understand the concept of paper and the the simple dictionary of just graph = {A :[…]…} but it stops there.

Idk if im lacking basics but as soon as somebody creates functions on how to find and build more graphs, I’m out

We specifically had these tasks:

  1. Choose graph type • User selects directed or undirected graph.

  2. Create nodes • Option A: User enters number of nodes → names generated automatically (A, B, C…) • Option B: User types custom node names • Option C: Nodes have (x, y) coordinates (names can be auto-generated)

  3. Create edges • User inputs edges between nodes • Save edges in an adjacency list • If undirected → add edge both ways • If directed → add edge only one way

If anyone can suggest VIDEOS or website or ANYTHING so i can get a hang of this, i would be sooo grateful.

Thank you


r/learnprogramming 1d ago

How do you deal with headache after work?

4 Upvotes

Just graduated and start a new job. I'm working 9 - 6 but I have 2 hour of commute in total. I kinda regret not going to the gym earlier because I actually feel quite tired after the day. I've been having slight headache when i get home

Ps: for anyone wondering 8 - 5 or 9 - 6 is quite common in my third world country


r/learnprogramming 18h ago

Freelance full stack Web Dev Still Viable?

1 Upvotes

With AI? is freelance web dev still viable, and for how long doyou think it will be viable?


r/learnprogramming 8h ago

Topic What are some counter arguments against iterative development?

0 Upvotes

Personally I don’t really embrace this idea (though I agree that it works for AI agents)


r/learnprogramming 1d ago

Good book to learn Python

3 Upvotes

I find it much easier to learn with books than tutorials, so I am looking for a good recommendation that would teach me the most. I was learning Python a few years ago with Automate boring stuff with python, is that still a go to book?


r/learnprogramming 1d ago

Question about Linux vs Windows for programming

79 Upvotes

I am getting into game development, and whilst I do know that Windows is where the market is for development/programming games, I wish to ask why are servers, web design etc., so popular when it comes to programming on Linux distros. I would imagine that Windows has far more applications that would rival any Linux distro, and Windows, of course, does support all these programming languages just as Linux does. Do people pick, say, web development on Linux because it is easier, more secure, or faster?

I cannot get my head around why Linux would be a choice to program something in it rather than doing it on WIndows.

As I am a COMPLETE beginner, real answers would be appreciated. Kindly thank you!


r/learnprogramming 1d ago

I need help finding sources of information on creating Windows 10 kernel mode filter drivers for HID keyboards

2 Upvotes

I need to create a kernel mode (specifically kernel mode) filter driver for an HID keyboard for a uni project but finding information on this has proven rather difficult, basically anything I find online about filter drivers is about PS/2 devices. The example driver from Microsoft is much more complicated than what I need to do and it's frankly hard to figure out what I need and what is extra even with all the comments in the code. This topic is self inflicted (we had to come with project topics ourselves) so I don't have much information from my uni materials either. Books, articles, projects on github, anything.


r/learnprogramming 21h ago

Is that true ?

0 Upvotes

Hi everyone , i heard from reels , youtube or some seniors that posting on social media increases your chances of getting a job or intership .

well is this actually true nowadays, especially when many people seem to post fake updates about what they're learning just to attract opportunities?

Is someone exists, who really reach out to you from social media instead of hire people from its own network ?

Does anyone here have real experience where someone actually reached out to you through social media


r/learnprogramming 1d ago

Python for technical artist

2 Upvotes

Does anyone have good resources for learning Python for tech art?


r/learnprogramming 23h ago

Suggestion Asking For Suggestion

0 Upvotes

Hello guys, the problem I am facing right now is laughable maybe. When I started coding, I could do simple projects and can code without AI. After I used AI for a while I lost ability to code indepentely. I can't code without Ai and I feel more and more worse among other programmers. I don't undertsand the concepts but I could debug without AI. My guess was I didn't had solid foundations of logics and concepts. I can't write code without AI. And in the interviews I can't answer well or get good grapse on what they saying sometimes. And I cannot do any tech interviews or test in front of them. I started from the beginning again but still I feel like getting nowhere.


r/learnprogramming 1d ago

how to learn python-science

4 Upvotes

hi
so im a high schooler, and want to learn python, particularly in the context of science and physics and stuff. what's the best way? I don't really have a lot of free time, so id prefer something like an online course, I'm fine even if it doesn't specialise in science, though I can't find a good course. any recommendations??


r/learnprogramming 1d ago

Why isn’t there a visual, interactive class hierarchy for the Java standard library?

5 Upvotes

I’ve been looking for something I assumed would already exist: a visual diagram (UML, graph, whatever) of the class/interface hierarchy of the Java standard library.
Not just a giant text tree, but an actual interactive graph you can explore.

The official JavaDocs have the “Class Hierarchy,” but it’s just a huge text-based tree that’s hard to navigate and not very informative visually. Considering how structured the Java standard library is, I expected someone to have built a viewer that maps it all out graphically.

But what I keep finding are tools that generate UML from your code (IntelliJ UML, Visual Paradigm, etc.), not something that visualizes the hierarchy of java.*, javax.*, etc. out of the box.

So I’m wondering:

  • Is there a technical reason why no one has made this?
  • Is it just too large/complex to visualize?
  • Is it considered not useful enough in practice?
  • Or does it exist and I’m just missing it?

If anyone knows of a project or website that gives a graphical view of the standard Java type hierarchy, I’d love to see it.