I'm hesitating... need some feedbacks!

@nathanguyette it seems you are the closest in mind-set to me
First of all, thanks for the reply!

I think dependency management, refactoring (in editor or multi cursors super editing using VSC - actually I am an old user of Sublime Text, which is the base of VSC are something very very handy), QA with automated testing, production management all important when it comes to a product. Testing is essential, since I use to run Q&A division and I’m a former build master at Sony AAA game studio, etc, so I’m a bit keen on this part too. I was always the one who started first writing test, then the code…

Still, I see potential in Anvil. It is a different approach, need to “rethink” how and what needs to be done. Testing has many way of doing, i.e using automated UI test tools can actually run a test without any anvil integration. (you can program to click and check results in UI or in your own app/db whatever… long time I’ve used anything like that but there is always a way around)

2 Likes

Yeah, that’s all about Anvil for sure!
SPA: that’s exactly what I want, so that’s not an issue
DB: I can use my own db on my own server using uplink, so no problem. I did a test with both, using my own DB and using Anvil’s DB. The latest is way to simple and difficult to use to me. I mean I can get everything I want with sql especially using views and stored procedures in the DB. Using python to get around a query is kind of a headache to me. (ie. multiple rows key with multiple tables… took me some time to figure out how to get what I need and I did not like the results)

Btw, running your own DB on a virtual server is a no brainer. you don’t need that much of a maintenance for it. But I can understand to keep everything within Anvil is also a strong feature.

I think you just answered one of the biggest concern of all, when it comes to using any tool. I also wrote some “hard reading long email with some “silly” questions” to them and yes, I’ve got clear answers. (support test passed for me).
I am also surprised with you guys, all the comments in such a short time. And all of them full with VALUE, not just a “I like it dude” type of answers. I really appreciate all of your effort and help here and I’m also convinced that both the forum and Anvil team is there to help when needed!

I’m pretty sure I can also find someone to help if needed in a long term.

Regarding python / strong vs loose typing. Well, I’m from C background and my first official work was in a security team helping others to clean their codes and make it bullet proof. (esp. against exploits, virus, hackers, etc). So for me, I always use typing. I never wrote a “var i” in my C# code! Never! If you keep your type clean, you use it always, you wont waste any time! If you use var and later you want to figure out the right types, you will loose time for sure. Anyway, that’s me.
I love python and I use to write my servers / backend (ie. for game servers) in python. No typing is just another way of handling typing :slight_smile: you always has types, it is only hidden from your eyes.

Don’t forget, you write your code to human not for a computer! (or you should write it in pure machine code). So no matter if it is strong or week/loose typing, you have to write in a way it will be clear not only for you but for any other developers.
Back in some days, when I run a 30+ dev team, I had a rule: write code so, that the worst coder in our team can understand it. No fancy pency feature rich syntax, because it will lead to errors… it worked very well. If easier to read, easier to understand, quicker to change without creating bugs.

3 Likes

This is it, python does not need to be typed if written in this way. But like any writing implement, even a pen and paper can be used to make the most grammatically correct esoteric sentence that hardly any person can understand, or the most simple point imaginable with very few, clunky but simplistic literal words.

I have been writing python since before there was a standard typing module, nothing stopped me from naming variables something like orders_list or id_to_employee_name_dict, or checking object type equality with isinstance()

Also as far as anvil goes:

I like it dude!

Like @stefano.menci , I use it at my company solo.
I can create UI’s for people to use who only have the technical capacity of using a cell-phone browser, and expose to them the results of long processes of hard logic that comes from the live backend of the company ERP that they would never otherwise have the ability to access.

It is all multiple databases, old systems, SQL, and lots of on-the-fly ETL. Anvil uplink just works with it so I don’t have to constantly monitor everything.
It just works without users complaining, and that’s why I use it.

Oh also I can make something in 3 days that would have taken 3-6 months of work before it was ‘ready for prime-time’.

5 Likes

I have never used an external database with Anvil, but I think using uplink is not the right way. I think using a connection to the external database will manage exceptions, transactions, caching, etc. for you, while using uplink you would be in charge of all of that.

Another consideration about using an external database is the Users service: the Users service uses the Users table in the Anvil database, I think it is impossible to use another database for it. So, you either leave the Users table in Anvil and the rest on your own external database, or you redesign your own user management that uses the external database. (Or I am wrong, and it is possible)


I started my first reply by describing my use case and by saying “My first priority is my own productivity” because I know you are in a different place.

Still, since we are talking about Anvil/Python and you like C#/strong typing, I thought this digression would add some value to the discussion.

Just to pick an example, I have posted two custom components in this forum: DataGridJson and InputBox. I have done similar dynamic UIs in VBA, VB6, Python and other proprietary scripting languages, all with flexible typing. All did their job and some are still used after decades.

I also have done something similar in C#. Managing a json without schema as input and all those input components with slightly different behavior was a nightmare of generics and types and classes. The final result was a strongly typed component, very easy to use, covered by tests. But it took me 10 times longer to develop and it was impossible to understand unless you dug through all the classes.

Using Python I feel confident that if I (or the worst coder in the team) need a change in behavior next year, when I forgot how those components work, I can just open them, understand them, change one line of code and get the new behavior. (It has happened already many times.)

Using C# I was never able to get something old that I had forgotten, quickly understand what happens inside, and change its behavior without adding more and more classes or butchering the whole thing.

I’m not mentioning the DataGridJson or InputBox to show how a component should be done in Python. They are far from perfect. Very far! That’s the point: in Python you can be sloppy and get the job done.

I am mentioning them as a success story: it was fast and easy to create them, it will be easy to maintain them, they just work. No, they don’t have tests, because they are so simple that they don’t need tests. The same beast in C# would need tests, because it would be so complex that I wouldn’t trust it without tests.

1 Like

Just to add a few responses on things that I’m not sure others have addressed directly:

  1. I’ve been working on a hobby app since late 2018 and have not had any trouble with Anvil updates. They even still support Python 2. (I occasionally see others report temporary bugs affecting old apps, but they are addressed promptly when reported.) The closest thing to an issue I’ve had is that when new features are released or new third-party components appear, it can be a tough decision whether to overhaul parts of my code to use them going forward.
  2. Others have mentioned the new support for multiple branches and staging environments in the Beta IDE. Whether or not you use that (it’s nice but it’s still in beta), know that you can also go back and forth between a local git repository and the Anvil IDE fairly easily. In short, you can combine the full power of git version control with the benefits of the online Anvil editor. There are some finer points to making it work smoothly that you can read about elsewhere (in the docs, with more on the forum), but the basic idea is that you would “Clone” your production app within the Anvil IDE and then force-push code from the base git repository to that new Anvil-hosted app. That gives you a way to work in the Anvil IDE in a way that is isolated from your base production app, while retaining the ability to git merge in updates from the production code base.
1 Like

I had the same idea as you mentioned here with git cloning, now I know it is possible to do.
Thanks @hugetim !

1 Like

Here you could find more ideas: [Wiki] Best practices: Test-driven development with Anvil

@stefano.menci
your approaches and what you already mentioned with “being messy” improve when needed approach reminds me to old Xtream Programming mixed with some other principles

It is definitely not new concept and most of us doing it so.

ie. did you know that in an average software company (including big one like IBM, MS, Google, etc) over 90% of the new code will be deleted completely within 1 year! Yes, imagine tons of work devs doing that ending up in trash bin… still, this is a way to go. It is a very old stats, yet still valid. Nasa did huge effort to try to keep this under control using zero defect programming, (another methodology to good to be familiar with) and they did get around this problem somewhat, but it took another approach which is more suitable for a company, where the goal is clear before they start to make it real. Still, producing many prototype phases, which is almost the same time-effort wise as the 90% code waste…
Zero defect -in a very simplified way to say is: as early you can find a bug as cheaper it takes to fix.
Just think about it if you have a property set to a value which later find out it is not the right one to be used (i.e how many products a user can buy at the same time), fixing this limit has a huge difference based on when are you fixing it, at desing it costs like 10 cents 1 sec, (just write a bigger number) in coding it is not more then $1 and 10 sec , however when it is released it can reach $1000 and months, since need to do the whole cycle from catching the bug, identify the problem, redesign, recode, retest and release & deploy…

So get back to the main point here, being messy - or as I would say start with prototyping phase is normal for most cases. It is a way to go when you are a small team for sure. As you will hit some barrier you might think to redesign it or as we call it refactor it. This is a common way of software evolution, nothing bad about it.

It is a very common mistakes we programmer use to make is to either think too far and try to create an API or function or feature to make it easier to use / change later and adding unnecessary parameters, which might never be used in the hope it might will be needed. On the other side, sometimes we forget that we are not the only one to use this, so there might be a good reason to add a bit more common usage to it…

I think the best way to go is what you feel best at the time. Don’t get too complicate and make it as simple as you can. You can always make it complicated later :stuck_out_tongue:

So I can totally understand your point of “being messy” (although it has nothing to do with messy)

1 Like

Python and dynamic typed languages in general are good for banging out prototypes.

Sure lots of production code is written in python, and IDEs can infer types and give you autocomplete, in spite of the fact that it’s harder to do without strong typing by default.

It’s all trade offs of course. Using the right tool for the job.

That being said, IDEs are becoming so smart, lot’s of the differences and trade offs are being smoothed out.

Want stronger runtime guarantees? You’re gonna pay for it with static typing, though there’s a million and 1 different JSON to wrapper class products that exist for C# so that isn’t really a good argument for python for that particular case.

Want thread safe composition of blocks of code? You’re gonna want a pure functional programming language.

The nice cushy IDE / library support for languages like Haskell don’t exist, yet, so I won’t use them, except for toys.

Establishing market demand for a product is best done where you have low overhead cost.

Like a scouting mission done on a motorcycle. It’s fast, it’s dangerous, but damn it’s really fun.

How much comfort do you want though? Leather seats? Cruise control? It’s all subjective consumer preference, driven by what the individual person values and wants.

Once you establish there is gold in them there hills, you need to start taking less margin over time, and investing in more complicated infrastructure to efficiently cart the gold back to be processed.

1 Like

Actually that’s exactly the argument!

In Python I don’t need any wrappers, it just works.

  • How do I use json in python?

import json

  • How do I use json in C#?

It depends on who you ask and what class of what project you look at and when it was done and what is the alignment of the stars and blah blah blah.

Not really “one-- and preferably only one --obvious way to do it”.

You can add all the wrappers you want to C# so you make it as fun as Python. I will use Python :slight_smile:

I mean static typing is the default, but if you really want to give it up, you can use the dynamic keyword.

And just to be fair there is some stuff I really like about Python.

Like not forcing everything to be a class.

Sometimes I just want a collection of free floating function definitions ya know.

Why C#. Why.

1 Like

In the (almost) five years I’ve been working with Anvil (I’m a freelancer), I have clients with apps that

  • run at scale publicly to hundreds of thousands of users
  • run privately for a handful of users but are business critical
  • embedded into the physical product they produce and shipped with every unit
  • integrate with a host of existing systems

And all work beautifully (most of the time).

I’ve previously used all sorts of other Web frameworks over the years (I first coded on a zx81, so been doing this stuff a while too) and I won’t be going back to django/Ruby on rails/anything else any time soon.

Good luck!

3 Likes

Coding in general is a mix between exploration, and producing reusable “widgets”.

Somewhat akin to market processes.

The vast majority of experiments fail. But as long as they fail quickly, damage is mitigated, and information can be gleaned on what not to do.

Zero defect programing sounds like someone who is playing in a 0 sum game. A political game.

A catch all impossibility for managers to brandish.

Reminds me of this line from Brazil.

“Mistake? Haha. We don’t make mistakes.”

2 Likes

That bug was caught by the type-writer, not by the type-checker!

ZX80 here, but it’s not a competition :slight_smile:

I remember writing flicker free graphics in z80 assembler. You had to put the hex on line 10, then execute a poke to turn it into line 0 which then executed as machine code. Ah, halcyon days…

Some context. Every key press caused the screen to flicker, in fact every operation did. Removing it was quite a feat.

Back when people were really creative :
http://www.fruitcake.plus.com/Sinclair/ZX80/FlickerFree/ZX80_DisplayMechanism.htm

But I’m off topic. My apologies. Nurse will be around soon.

4 Likes

Heading further off topic, here’s a talk I gave a while back (apologies for the use of some other Web framework)…

4 Likes

off topic is nice, especially when I can see how many of “us, veteran programmers” are here!

Actually my very very first experience with computers were on ZX81 too, infact, I want to learn programing because of a ZX Spectrum! But a year later, when we bought our very first computer, c64 was already ruled the world… in mid eu for sure. I can see that people in England was most likely bought zx81 or ZX Spectrum from Sir Sinclair :slight_smile:

The most creative app on a c64 was a music player for me, using the floppy disc motors, spinning them the way it will generate sounds. I heard a Madonna song coming out of a C64’s floppy first :slight_smile:

I’m sure we did not had discussion over strong and loosy typing, neither frameworks or cloud computing :slight_smile: instead we have LDX, LDY… and sprites

1 Like

vic20, c64, c128… this was dual boot, basic or cpm!

Good times!

Then the DOS popped up, I got a portable, an 8086 similar to this one (my brother called it “the microwave”)

image

The display had only 4 shades of gray and I couldn’t play Tetris, because the blue blocks had the same shade as the black background.

So I became a local legend when I made a TSR (terminate and stay resident program made in assembler) that was scanning the graphic card memory 18 times per second and changed the color of the blue blocks as they were coming down.

Good times!


Thanks @attila for giving us a post we could hijack and go down on memory lane.

4 Likes

Interesting topic… I have been hestitating to use anvil for a long time with speed, coding in the browser, widget limitations and layout being my main concerns but I am glad I chose Anvil. I am a big Flutter fan which was the first platform for me when I started to write my app. The problem with Flutter was that most of my logic code is in Python and I had to write an API to access that logic with all the problems of authentication, docker images etc etc. State management in Flutter was also a complicating thing as well as connecting to my databases etc. I also tried Django but I hate to be writing Python and Javascript and CSS and HTML… then I used Streamlit which is nice but limited and then I found Anvil. So far I am very happy with Anvil… development time is really fast and it’s nice to only focus on writing Python code and connecting to my Python libraries. I still think I have a lot to learn and I do have some things that I do not like (mostly the web editor and the code I need to run on a seperate Digital Ocean droplet for all missing dependencies (I am on the personal plan but my package isn’t supported… which makes sense because I would probably be the only user :wink: ) but I hope to find ways to be even more productive. But it is such a relief to not have to struggle with database connections, authentication, publishing to web etc. etc. so that’s the biggest plus I get out of using Anvil. I still like Flutter and if I had the time and money I would probably still use Flutter but for a one man team with a lot of domain knowledge in Python code there is no way I could be as productive without using Anvil.

4 Likes